Gossamer Forum
Home : Products : Links 2.0 : Customization :

How to remove ~~ in links.db with checkbox

(Page 2 of 2)
> >
Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
Ulala, did you stay here the whole night?
Ankom, the codes I provided are definetly for checkboxes, cause I took them right out of my LINKS and if you'd take a look, it's checkboxes I'm using.
Maybe I missed a step of installation somewhere, maybe I check it once again...

But anyway, the corrected codes for templates Eliot provided should be working. If I understand it right, for non templates you need to put a string equal to the output you want to show up. This string you set up in your global definition in site_html_templates.pl
The reason why you're getting only one language returned is that if there's a second language found in the string it's overwritten with the new "flag". I think you'll have to add the output to the string instead of overwritting it with something new - see the codes below, the changed thing is the bolded point:

Code:
# Show_Language MOD. Denis Campbell / Eliot Lee -------------
if ($rec{'Sprache'}) {
$langimg = qq|<small class="date">|;
}
if ($rec{'Sprache'} =~ /D/i) {
$langimg .= qq|<img src="path/to/picture.gif">|;
}
if ($rec{'Sprache'} =~ /S/i) {
$langimg .= qq|<img src="path/to/picture.gif">|;
}
if ($rec{'Sprache'} =~ /A/i) {
$langimg .= qq|<img src="path/to/picture.gif">|;
}
if ($rec{'Sprache'} =~ /N/i) {
$langimg .= qq|<img src="path/to/picture.gif">|;
}
if ($rec{'Sprache'} =~ /E/i) {
$langimg .= qq|<img src="path/to/picture.gif">|;
}
if ($rec{'Sprache'}) {
$langimg .= qq|</small>|;
}
# End Show_Language MOD ----------------------------------
Hope this will work. If you managed to show up already one flag then it should, I hope.
If not you can post experiences here.

Thanks a lot for setting up the non-template instructions, Eliot.

Denis

Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
THAT'S IT. It works. And this is with checkboxes

Thanks all for your help, specially Denis and Eliot.

I will post steps from the beginning for those, who may be interested to use this Mod with Template

in your links.def

Add new field in _def:

Language => [17, 'alpha', 5, 60, 1, '','language1|language2|language3'] (put comma, if it's not last field)

Add new checkboxes field (if not exist):

#Adding checkboxes field <INPUT TYPE="CHECKBOX">.
_checkbox_fields = (
Language => 'language1,language2,language3'
);



in your site_html_templates.pl

Add in sub site_html_link under my %rec = @_;
# Show_Language MOD. Denis Campbell 2000 -------------
if ($rec{'Language'}) {
$langimg = qq||;
}
if ($rec{'Language'} =~/language1/i) {
$langimg .= qq|<img src="path/to/images/language1.gif"> |;
}
if ($rec{'Language'} =~/language2/i) {
$langimg .= qq|<img src="path/to/images/language2.gif"> |;
}
if ($rec{'Language'} =~/language3/i) {
$langimg .= qq|<img src="path/to/images/language3.gif"> |;
}

#End Show_Language MOD ----------------------------------


Then define
langimg => $langimg,

Add this in sub site_html_add_form
#----------------------------------- Add new checkbox field for Language------------------
my $language = shift;
$language ?
($language = qq~$language <input type=hidden name="Language" value="$language">~) :
($language = &build_checkbox_field ("Language", "$in{'Language'}"));
#----------------------------------- End of adding checkboxes for Language-----------------


Then define
Language => $language,

in your add.html

Put this

<input type="checkbox" name="Language" value="language1"> - <img src="path/to/images/language1.gif">
<input type="checkbox" name="Language" value="language2"> - <img src="path/to/images/language2.gif">
<input type="checkbox" name="Language" value="language3"> - <img src="path/to/images/language3.gif">

You may also modify add_error.html, add_success.html, modify.html, modify_error.html and modify_success.html.

in your link.html

Add this somthere you want falgs will be shown
<%langimg%>

And what is all, folks.

Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
Thanks for posting the complete instructions...and for those who may be confused (like I was)...DENIS wrote the ORIGINAL hack and I helped with some codes for template users. This hack was not written by Ankom. Wink

Regards,

Eliot Lee
Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
Hi Eliot,
I don't want to claim Denis Authority of this hack and your update the Denis's Code for Templates.
I just want other user don't spend so much time as I did.

Anyway, i thanks Denis and you for the help.

P.S. I also took a small part in hacking this Code Wink.


Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
You did...however, I was confused with your earlier post...the interpreted your message to be the following:

"Thanks to Denis and Eliot for helping me write this code hack and here it is!"

Regards,

Eliot Lee
Quote Reply
Re: How to remove ~~ in links.db with checkbox In reply to
Eliot, I edited my earlier Post

I am sorry for this

(But I never wrote, that this Code is writen by Ankom...Wink)

Thanks again and again

Best wishes

Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
Hi!

i have used this mod and i do have two aditional questions;
1. I'm using password/modify mod and if i enter in links.def Language string (at prelast field which is Password i add comma) later when modifying the link i get error "there apearr to be something wrong with password ..". If i remove Language string everything is normal when modify.
2. How do i break lanugages when dispalying in link.html
i.e.
URL: http://www.teleorder.de/ballonftest/
Site uses language(s): EnglishGermanDutch
(ID: 1773 | Added: 19-Nov-2001 | Hits: 0 | Rate: 0 | Votes: 0 )

thanx

Gregor
Post deleted by sc2utp In reply to
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
Hi!
i've solved those two problems..for those who have the same problem:
in site_html_templates i have removed img code and put pure text i.e. English German .. and also put characteres like =English==German= so they are not stucked together .. well mi kind of solution :)
about password i have put Language into modify_success and now everything works great.

and here we come to last problem...

this code
Code:
sub site_html_modify_form {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.

my %rec = @_;
my $category = &build_select_field ("Category", "$rec{'Category'}");
#----------------------------------- Add new checkbox field for Language------------------
my $language = shift;
$language ?
($language = qq~$language <input type=hidden name="Language" value="$language">~) :
($language = &build_checkbox_field ("Language", "$in{'Language'}"));
#----------------------------------- End of adding checkboxes for Language-----------------
&html_print_headers;
print &load_template ('modify.html', {
category => $category,
Language => $language,
%rec,
%globals
});
is not giving me what i want when modify. i want to appear check boxes just as when adding resource.

and what codes should be put then for add success and modify success?

thanx a lot inadvance

Gregor
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
Hi Eliot!
After reading this article for 10 times and also others, i stil lcannot configure out, how to use these code in modify.html since i'm using password mod. Now i get language field in text boy instead of check boxes..

please if there is any idea how to work this out, cause my "modify Resource" link is on standby, while langiage mod is not wroking correct when modify. Everything else works great when adding site to db.

thanx in advance

Gregor
Quote Reply
Re: [sc2utp] How to remove ~~ in links.db with checkbox In reply to
The main reason that the oodes you are using in the MODIFY form subroutine in the site_html_templates.pl file is that you are using the wrong codes...

You need to use $rec{'Language'} NOT $in{'Language'}. And you will also need to check for the ~~ characters in the Language column in the links.db.

In order to modify the Language column, you will bascially need to add more codes than you've posted...

But you're on the right track at least.

And BTW: The Password Mod poses no conflict...the problem is with the codes are are attempting to use.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
Hi!

thanx for quick answer as always Smile I've checked links.db and there are languages separated with ~~ .

About $rec{'Language'} ..no problem, what i am worried is, which code should i add as you stated .. as i am no programer Unsure

thanx in advance

Gregor
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
Hi!

i have done quickest solution for now ... i have just copied codes from add.html to modify.html and then modify.html overwrites languages in links.db Tongue

now second step would be to get those checkboxes be chekced if language is in links.db Unsure

thanx
bye

Gregor
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
well my knowledge of perl is not far enough to handle this modification alone.

if you perl gurus have a minute, please help me

tenx in advance

Gregor
Quote Reply
Re: [Heckler] How to remove ~~ in links.db with checkbox In reply to
just putting topic back to top Tongue

Gregor
> >