Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Adding A Date Range to Categories

Quote Reply
Adding A Date Range to Categories
Hi:

I was thinking about adding some functionality to my site... don't know if it would be too easy or not, so I thought I'd see what you guys thought. As you may know, my install is not Links, but a list of cartoons. I use Add_Date as the day the cartoon was released. So I thought it might be nice to add something to the Category title that shows the beginning and ending year of a series... sort of like:

Flintstones (1961-1967)

As I think about it, it might be better to just add a new field to category (called Range or something) and just run a script to update the field, rather than have a plug in- the Range is not likely to change.

Anyway, I have too many entries to do this by hand (OK, call me lazy). Any ideas how to do this?

Thanks!
dave

Big Cartoon DataBase
Big Comic Book DataBase
Quote Reply
Re: [carfac] Adding A Date Range to Categories In reply to
You could do this with a global. Something like this (change date to the name of your column):

sub {
my $id=shift;
my $db=$DB->table('Links','CatLinks');
$db->select_options('Order by date desc','limit 1');
my $lastdate=$db->select(['date'],{CategoryID=>$id})->fetchrow_array;
$db->select_options('Order by date asc','limit 1');
my $firstdate=$db->select(['date'],{CategoryID=>$id})->fetchrow_array;
my $output = "($firstdate - $lastdate)";
return $output;
}
Quote Reply
Re: [afinlr] Adding A Date Range to Categories In reply to
Good idea and nice solution! Cool

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...