I have been using some code I found in the Plugins forum for a random link display on my home page:
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;
}
What I wanted to do is make the global check that the link is not only Validated ('isValidated' => 'Yes') but is Featured as well ('isFeatured' => 'Yes'). I tried:
sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes', 'isFeatured' => '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;
}
but it didn't seem to work.
Also, for some reason when I use this it will only display the full link.html and won't let me loop to use just some of the link options.
Any ideas? TIA!
--
Kriis
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;
}
What I wanted to do is make the global check that the link is not only Validated ('isValidated' => 'Yes') but is Featured as well ('isFeatured' => 'Yes'). I tried:
sub {
my $db = $DB->table('Links');
my $total = $db->count ( 'isValidated' => 'Yes', 'isFeatured' => '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;
}
but it didn't seem to work.
Also, for some reason when I use this it will only display the full link.html and won't let me loop to use just some of the link options.
Any ideas? TIA!
--
Kriis