Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: Re: [tondelo] Alternating Row Color: Edit Log

Here is the list of edits for this post
Re: [tondelo] Alternating Row Color
Tony,

I prefer using the Global methods. Go to Build>Template Globals>

change the option:
link_results

from :
sub {
my $vals = shift;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC');
my $sth = $link_db->select;
my $output = '';
while (my $link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link', $link);
}
return $output;
}



to what andy suggested:
sub {
my $vals = shift;
my $link_db = $DB->table ('Links');
$link_db->select_options ('ORDER BY Hits DESC');
my $sth = $link_db->select;
my $output = '';
my $cnt = 0;
while (my $link = $sth->fetchrow_hashref) {
if ($cnt / 2) {
$link->{even} = 1;
} else {
$link->{odd} = 1;
}

$output .= Links::SiteHTML::display('link', $link);
$cnt++;
}
return $output;
}



Then open link.html and add the
<%if odd%> odd color <%else%> even color <%endif%>



TRY THAT



Sandra Roussel
Chonsa Group Design - Fresh Start Housing

Last edited by:

SandraR: Mar 16, 2005, 10:35 AM

Edit Log: