Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Customizing

Quote Reply
Customizing
Hi

How may I make category listing in "different color". See this example: http://bruktbil.norskbildelsenter.no/Queries/QueryAll.asp .

Are
Quote Reply
Re: Customizing In reply to
All I see in terms of color on that example site are blue images...? You should be able to change the category color (text) by adding in <font color=""> tags in the subcategory.html template.

Dan
Quote Reply
Re: Customizing In reply to
 
I ment the gray background on each 2´nd line (ok..its not really a color):-)


Are
Quote Reply
Re: Customizing In reply to
All that's happening there is the rows of the table have alternating background colours:

e.g.;

<tr>
<td bgcolor="#FFFFFF">White background</td>
</tr>
<tr>
<td bgcolor="#C0C0C0">Grey background</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">White background</td>
</tr>
<tr>
<td bgcolor="#C0C0C0">Grey background</td>
</tr>

etc ...


All the best
Shaun

------------------
Shaun Hague
Webmaster - Qango.com
http://www.qango.com/central/
Quote Reply
Re: Customizing In reply to
There are two ways to do it, but I think the easiest is to look at the code in the print_cat routine.

Where it's set up to do two columns, and you enter a link into each, what you want to do is make the loop to enter two ROWS of one etry each, and make the first row grey, and the second row white, then loop back.

Assuming your link.html has _NO_ open table code -- ie: either has no tables, or begins with a TABLE tag and closes with a TABLE tag:

Something like:

Code:
# Print Header.
$output = qq|<div class="margin"><table width="100%" border="0" cellspacing="0" cellpadding="0">\n|;
$i = 0;
my $bg_color_tick = 1;
foreach $cat (sort @names) {
$cat_r = $subcat->{$cat};
if (($bg_color_tick/2) != int($bg_color_tick/2)) {
$output .= qq|<TR><TD BGCOLOR=grey>|;
} else {
$output .= qq|<TR><TD BGCOLOR=white>|;
}

# Get the URL and the Category name.
$category_url = $LINKS{build_root_url} . "/" . &build_clean_name ($cat_r->{Name}) . "/";
($cat_r->{Name} =~ m,.*/([^/]+)$,) ? ($category_name = $1) : ($category_name = $cat_r->{Name});
$cat_r->{Short_Name} = $category_name;
$cat_r->{URL} = $category_url;

# If you are using the three level new, uncomment the following to have Days_Old available in the
# template.
if ($cat_r->{'Has_New_Links'}) {
$cat_r->{'Days_Old'} = &Links: BSQL::date_diff (&Links: BSQL::get_date, $cat_r->{'Newest_Link'});
}

# We check to see if we are half way through, if so we stop this table cell ## get rid of this code! we aren't making columns
# and begin a new one (this lets us have category names in two columns).
## ($i and ($i % $breakpoint)) or ($output .= qq|</td><td class="catlist" valign="top">\n|);
## $i++;
defined $dynamic and &load_user ($dynamic, $cat_r,);
$output .= &load_template ('subcategory.html', {%$cat_r, %GLOBALS} , undef, $template);
##_## had to pass the %GLOBALS and %$cat_r as a hash to the routine
$output .= qq|</TD></TR>|; ## Close the element, and the row.

}
# Don't forget to close the table! Each element is one complete row, so only the table and 'div' needs closed.
$output .= "</table></div>\n";
return $output;

What that will do is alternate the colors as the links are iterated, but it will deactivate the code for multiple columns.

If you can't figure it out, maybe I can hack something, since I've done similar on my site to get the categories highlighted, and the descriptions inset.

You will probably have to tweak it, since the code has probably been changed for my site, but the 3 areas you have to look at are the three assignments to the "$output" variable, and what's going on.

Also, the fact that we are _not_ making columns, so that code is removed. I left it in as a place holder to get your bearings.

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Customizing In reply to
Hi


Is it also possible to apply this to the links background too?
Quote Reply
Re: Customizing In reply to
The BGCOLOR and BACKGROUND tags seem to work in both Netscape and MSIE in both the TABLE and TD tags, one overriding the other. The effects are _much_ different from browser to browser, so you need to check them out.

But, the code logic would be the same.
Quote Reply
Re: Customizing In reply to
Hi

I am not a cgi programmer, so I wonder if there is someone that can give me detailed instructions on how to apply the different listing on the links-background (where the <%links%> variable is. I can see that pugdog has this routine inside:

if (($bg_color_tick/2) != int($bg_color_tick/2)) { $output .= qq|<TR><TD BGCOLOR=grey>|; } else { $output .= qq|<TR><TD BGCOLOR=white>|; }

Ant that is exactely what I want to do, but instead of the category, I want it whith my <%links%> listing.

Thanks!
Quote Reply
Re: Customizing In reply to
In short, just look at the

sub build_category_pages {

Before each of the calls to

$OUT{links} .= &site_html_link ($tmp);

You need to set BGCOLOR parameters based on odd/even as before, and do something like:

$OUT{links} .= &site_html_link ( {$tmp,MY_BGCOLOR=>$MY_BGCOLOR});

Then in the links template, you'd have access to the <%MY_BGCOLOR%> parameter, and to avoid errors, you'd probably want to wrap it in an <%if%> tag otherwise use the default colors.