Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Detecting category from link.html

Quote Reply
Detecting category from link.html
Hi,

Im displaying selected links on the sites homepage (home.html) using the following sub:

sub {
my ($sth,$link);
my $db = $DB->table ('Links') || return $GT::SQL::error;
$db->select_options ('ORDER BY PriceSavingPercent DESC', 'LIMIT 1') || return $GT::SQL::error;
my $cond = GT::SQL::Condition->new('isValidated', '=', 'Yes', 'Rating', '>', '4', 'OurPrice', '<', '20.00') || return $GT::SQL::error;
my $sth = $db->select ($cond) || return $GT::SQL::error;
my $output =qq~<tr>\n<td colspan="2"><p><strong>Todays Discounts - Upto \$19.99</strong></p></td>\n</tr>~;
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link) || return $GT::SQL::error;
}
return $output;
}

example: www.coffee-maker-store.com

Im hoping to be able to modify the way these display by dropping the Availability and Rating info for each.

As far as I can tell the simplest way to do this would be to detect the category_id (0 for home.html) within the link.html template using conditionals.

i.e. if (category_id eq "0") {
# do some thing here
}

How would I go about adding category_id so it can be detected from link.html ? or would you suggest I hardcode each link within the sub itself and not use the Links::SiteHTML::display method?

thanks for your help,

Charlie

Last edited by:

Chas-a: Mar 9, 2004, 9:19 AM
Quote Reply
Re: [Chas-a] Detecting category from link.html In reply to
Not quite sure I understand what you are asking - if I'm correct you just need to replace

Links::SiteHTML::display ('link', $link)

with

Links::SiteHTML::display ('link_home', $link)

and create a new template called link_home.html that displays the link how you want.
Quote Reply
Re: [afinlr] Detecting category from link.html In reply to
Thats exactly what im after,

Thanks Laura.