Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page

Quote Reply
Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page In reply to
OK, awesome guys! Working well now!

My last question. I would like to display on the Featured Links page all links that are EITHER isFeatured = Yes OR paid links (i.e., ExpiryDate < FREE). Right now I have a global that pulls these links properly within categories (I call this from category.html):


Code:
sub {
# Displays the featured links on each category page.
my ($id,$search_db,$output,$sth,$link);
$id = shift;
$search_db = $DB->table('Links', 'CatLinks');
$search_db->select_options ("ORDER BY Title");
my $cond = GT::SQL::Condition->new(IsFeatured => '=' => 'Yes', ExpiryDate => '<' => FREE);
$cond->bool('OR');
$sth = $search_db->select({CategoryID=>$id}, $cond);
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link', $link);
}
return $output;
}


Here is my current featured.cgi:

Code:
#!/usr/local/bin/perl
#================================
use strict;
use lib '/var/home/moen/wiredbiz.com/cgi-bin/links/admin';
use Links qw/:objects/;
use Links::SiteHTML;
Links::init('/var/home/moen/wiredbiz.com/cgi-bin/links/admin');

local $SIG{__DIE__} = \&Links::fatal;

main();

sub main {
#---------------------------------------------------
#
my $pageNum = $IN->param('nh') || 1;
my $linksPP = 10;
my $start = $linksPP * $pageNum - $linksPP;
$start = ($pageNum < 2) ? 0 : $start;

my ($sth,$tab,$output);

$tab = $DB->table('Links');
$tab->select_options('ORDER BY Title', 'LIMIT ' . $linksPP . ' OFFSET ' . $start);
$sth = $tab->select( { isValidated => 'Yes', isFeatured => 'Yes' } );
my $hits = $tab->hits;

while (my $rec = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display('link3', $rec);
}

my $tags;
$tags->{'paging'}->{'url'} = $CFG->{db_cgi_url} . "/featured.cgi";
$tags->{'paging'}->{'num_hits'} = $hits;
$tags->{'paging'}->{'max_hits'} = $linksPP;
$tags->{'paging'}->{'current_page'} = $pageNum;
$tags->{'output'} = $output;

print $IN->header();
print Links::SiteHTML::display('featured', $tags);
}


So what I need to do is replace $sth = $tab->select( { isValidated => 'Yes', isFeatured => 'Yes' } ); with code that pulls all (a) all links that are validated and featured OR (b) all links that are validated and paid (i.e., ExpiryDate < FREE).

I tried stuff just to test like ExpiryDate => '< FREE' and ExpiryDate => '<> 2147483647", but no dice.

Thanks for all the help guys!
Subject Author Views Date
Thread; hot thread Building a Cool/New-Like Featured/Priority Page Jobu 12750 Aug 26, 2006, 11:03 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12566 Aug 27, 2006, 4:03 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12481 Aug 27, 2006, 5:31 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12505 Aug 27, 2006, 8:45 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12510 Aug 27, 2006, 9:39 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12455 Aug 28, 2006, 6:50 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12489 Aug 28, 2006, 7:00 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12453 Aug 28, 2006, 7:08 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12532 Aug 28, 2006, 7:11 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12459 Aug 28, 2006, 7:17 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12465 Aug 28, 2006, 7:20 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12583 Aug 28, 2006, 7:36 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12426 Aug 28, 2006, 8:26 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12443 Aug 28, 2006, 9:11 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12431 Aug 28, 2006, 9:42 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12437 Aug 28, 2006, 11:30 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12456 Aug 29, 2006, 7:40 AM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12391 Aug 29, 2006, 8:54 AM
Post; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12462 Aug 29, 2006, 9:09 AM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12445 Aug 29, 2006, 11:57 AM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12379 Aug 29, 2006, 12:44 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
jdgamble 12439 Aug 29, 2006, 5:10 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
fuzzy logic 3551 Aug 29, 2006, 7:22 PM
Thread; hot thread Re: [fuzzy logic] Building a Cool/New-Like Featured/Priority Page
jdgamble 3553 Aug 29, 2006, 7:53 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 3541 Aug 29, 2006, 10:56 PM
Thread; hot thread Re: [Jobu] Building a Cool/New-Like Featured/Priority Page
fuzzy logic 3560 Aug 29, 2006, 11:11 PM
Post; hot thread Re: [fuzzy logic] Building a Cool/New-Like Featured/Priority Page
rascal 3484 Sep 23, 2006, 11:56 PM
Thread; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
courierb 3360 Sep 2, 2007, 10:32 PM
Post; hot thread Re: [courierb] Building a Cool/New-Like Featured/Priority Page
courierb 3409 Sep 3, 2007, 12:36 AM
Post; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12423 Aug 28, 2006, 8:28 PM
Post; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12493 Aug 28, 2006, 7:12 PM
Post; hot thread Re: [jdgamble] Building a Cool/New-Like Featured/Priority Page
Jobu 12459 Aug 28, 2006, 7:06 PM