Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Random link breaks css bug?

Quote Reply
Random link breaks css bug?
When using a <%random_link%> global on my home.html page, the CSS background color is being lost in IE 5 pc and IE 6 pc.

See my other post with a photo of this problem. Specifically the link on home page problem.

I have determined that the background color is being lost due to the link.html being loaded via a global. I have rewritten the global a half dozen different ways and it still produces a link with the wrong background color.

If I <%include link.html%> on the home page, the background is the correct color.
Calling <%include link.html%> directly from home.html doesn't really work for obvious reasons. It has no idea what link I want and no id or anything else, but the linklisting box shows up, and it is in the color specified by css.

When using the actual global which displays the link properly, the background color is wrong.

So it is my conclusion that...
Calling Links::SiteHTML::display('link',$rec);
via a global is what is breaking the css in ie5 and 6 on pc.

I am spending an awful lot of time on these css issues, it would be nice to get some input.

Thank you,
Chris

my random global:
Code:
sub {
my $in_cat = shift;
my $db = $DB->table ('Links','CatLinks');

$db->select_options ("ORDER BY rand()","LIMIT 1");
my $sth = $db->select({ 'CatLinks.CategoryID' => $in_cat });
my $rec = $sth->fetchrow_hashref;
my $catID = $rec->{CategoryID};

my $table = $DB->table('Category');
my $cat_sth = $table->select( { ID => $catID } );
my $cat_hit = $cat_sth->fetchrow_hashref;
my $name = $cat_hit->{Link_Template};

return Links::SiteHTML::display($name, $rec);
}
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Random link breaks css bug? In reply to
I would rewrite that as:
Code:
sub {
my $in_cat = shift;
my $lcl = $DB->table('Links', 'CatLinks');
$lcl->select_options("ORDER BY RAND()", "LIMIT 1");
my $rec = $lcl->select({ CategoryID => $in_cat })->fetchrow_hashref;
$rec->{Link_Template} = $DB->table('Category')->select('Link_Template', { ID => $rec->{CategoryID} })->fetchrow;
$rec->{Link_Template} ||= 'link.html';
return Links::SiteHTML::tags('link', $rec);
}
Then in the template do:
Code:
<%random_link($ID)%><%include $Link_Template%>

Adrian

Last edited by:

brewt: Apr 26, 2005, 9:22 PM
Quote Reply
Re: [brewt] Random link breaks css bug? In reply to
I use static pages but wanted to have a random link generate on the home page every time it loads. I used the global I found here:

Code:
sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes' );
my $rand = int( rand($total) );
$db->select_options ("LIMIT $rand, 1");
my $link = $db->select->fetchrow_hashref;
my $html = Links::SiteHTML::display('link', $link);
return $html;
}


I call it with a SSI:
<div id="randomlink"><!--#include virtual="/cgi-bin/links/page.cgi?p=include_randomlink"--></div>

I was having a problem with the link failing to apply the CSS formatting (the rest of the block shows up fine). I finally was able to solve it by adding this to the CSS, which basically reiterated the formatting for this one block:
#randomlink h4.linktitle a {font-size: 12px; font-weight: bold;}