Gossamer Forum
Home : Products : Links 2.0 : Customization :

bicolor links background

Quote Reply
bicolor links background
Hi,
I guess there are several threads about this topic but I think this is a very easy to do mod to show your links with two different background-colors for example:

just ad to your sub site_html_link in site_html.pl

my $bgcolor ;
unless ($bi==1) {
$bgcolor="#F6F6F6" ;
$bi=1 ;
} else {
$bgcolor="#FFFFFF" ;
$bi++ ;
}

now you have a changing bgcolor $bgcolor

Cheers

Niko

------------------
Quote Reply
Re: bicolor links background In reply to
Thanks for the Mod...much easier and less codes than the other Modifications posted in this Forum.

Thanks for your time and effort.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: bicolor links background In reply to
Is there a version of this that will work with templates?

------------------
Will
Webmaster
FishHoo! Search index for Fishermen
www.fishhoo.com
Quote Reply
Re: bicolor links background In reply to
This can work with Templates...All you have to do is add the codes to the top of your sub site_html_link in the site_html_templates.pl file.

Then define the bgcolor tag as the following:

Code:
bgcolor => $bgcolor

Then add the following codes in your <td..> codes in the link.html file, like the following:

Code:
<td bgcolor="<%bgcolor%>" width="100%">

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------









Quote Reply
Re: bicolor links background In reply to
    Hi...
Congratulations for your great and easy mod..
But i'm having a problem... in mylinks templates it don't work.. I tryied to put a bgcolor => $bgcolor in all sub site_html_my_* what's the problem?? can anyone help me??

besides... a great number of tags that I use in normal templates is not working on mylinks

Regards.........
Quote Reply
Re: bicolor links background In reply to
Uh...You have to copy the following codes into the sub site_html_my_link routine in the site_html_templates.pl file:

Code:
my $bgcolor ;
unless ($bi==1) {
$bgcolor="#F6F6F6" ;
$bi=1 ;
} else {
$bgcolor="#FFFFFF" ;
$bi++ ;
}

Then define the bgcolor tag as follows in that same sub-routine:

Code:
bgcolor => $bgcolor,

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: bicolor links background In reply to
Getting an error (unknown tag) on link.html when trying this. Am I putting the code in the correct place? Here is a copy of my sub_site_html link

Code:
my %rec = @_;

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

return &load_template ('link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
%rec,
%globals
});
#Creates a bi-colored background for links

my $bgcolor ;
unless ($bi==1) {
$bgcolor="#F6F6F6" ;
$bi=1 ;
} else {
$bgcolor="#FFFFFF" ;
$bi++ ;
}
bgcolor => $bgcolor

}

Thanks,
Ian

[This message has been edited by Nofatals (edited April 04, 2000).]
Quote Reply
Re: bicolor links background In reply to
Uh...you are using the wrong codes and in the wrong place. Frown

*sigh*

Okay...put the following codes:

Code:
my $bgcolor ;
unless ($bi==1) {
$bgcolor="#F6F6F6" ;
$bi=1 ;
} else {
$bgcolor="#FFFFFF" ;
$bi++ ;
}

BEFORE the following codes in the sub site_html_link:

Code:
return &load_template ('link.html', {

Then define the tag:

Code:
bgcolor = $bgcolor,

AFTER the following codes:

Code:
%rec,

AND BEFORE the following codes:

Code:
%globals

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: bicolor links background In reply to
Hi Eliot,

I have unsuccessfully tried to install this mod (using templates).

I get this error:
Error including libraries: Can't modify constant item in scalar assignment at /usr/people/clients2/mydomain/cgi-bin/links/admin/site_html_templates.pl line 82, near "$bgcolor,"

I have carefully followed your instructions and checked again and again, but I'm a human being Smile , so I might be mistaken. Here is my sub site_html_link mod:

Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like.

my %rec = @_;
my $rate_img = "";
if ($imcool) { $linkurl = $rec{'URL'}; }
else { $linkurl = "$build_jump_url?$db_key=$rec{$db_key}"; }

# Set new and pop to either 1 or 0 for templates.
($rec{'isNew'} eq 'Yes') ? ($rec{'isNew'} = 1) : (delete $rec{'isNew'});
($rec{'isPopular'} eq 'Yes') ? ($rec{'isPopular'} = 1) : (delete $rec{'isPopular'});

my $bgcolor ;
unless ($bi==1) {
$bgcolor="#FFFFFF" ;
$bi=1 ;
} else {
$bgcolor="#F0F0F0" ;
$bi++ ;
}

return &load_template ('link.html', {
detailed_url => "$db_detailed_url/$rec{'ID'}$build_extension",
rate_img => $rate_img,
%rec,
bgcolor = $bgcolor,
LinkURL => $linkurl,
%globals
});
}

Anything wrong? I would appreciate your help.
Thank you.

Regards.
Quote Reply
Re: bicolor links background In reply to
Unfortunately, the UBB screws up some codes.

See all the semi-colons at the end of the codes I provided...Close up the spaces.

Also, what codes and tags are you using in your link.html file.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: bicolor links background In reply to
Thanks Eliot!

It now works fine. Your help is always appreciated.

Regards,

Olivier.
Quote Reply
Re: bicolor links background In reply to
Hi Jerry,

What is the advantage of your code vs el noe's? Is it more efficient?

Regards,

------------------
*******************
Olivier
oguerin@hotmail.com
*******************
Quote Reply
Re: bicolor links background In reply to
the code i use goes more like this..

Code:
($bgcolor && $bgcolor eq "#ffffff") ? ($bgcolor = "#eeeeee") : ($bgcolor = "#ffffff");

the code goes before this line

Code:
return &load_template ('link.html', {

and this is needed too

Code:
bgcolor => $bgcolor,

it is <%bgcolor%> in the template..

in this example.. the first color would be ffffff.. then the second color would be eeeeee.. the first color needs to be implemented twice.. once in the first and third one and the second color needs to be in the second one..

------------------
Jerry Su
url pdamania.com
email email@jerrysu.com
------------------
Quote Reply
Re: bicolor links background In reply to
It is more efficient in the sense of reducing codes, but not much different in output...they produce the same results.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.