Try this, just replace the routine in the Days_Old.pm.
It's leaner, and one purpose.
Code:
sub link_Days_Old {
# -------------------------------------------------------------------
# Version 2.1.2 Oct 17, 2004
# -------------------------------------------------------------------
# You call this tag by placing <%Plugins::Days_Old::link_Days_Old%> at the
# top of your link.html or detailed.html template, or wherever you
# have "Link" data, and want to use the <%Days_Old%> tag.
# The function makes sure the "isNew" value is a 1/0 so you can use "<%if isNew%>" correctly.
# The function returns an integer in the <%Days_Old%> tag. "0" means the link is not new, and you can deal with it.
# eg: <%if Days_Old%><img src=<%build_images_url%>/new_<%Days_Old%>.gif><%endif%>
#
# The function also updates the database, so subsequent calls to the link behave properly.
# You still need to "Repair Tables" or "Build" to get the category and subcat counts correct.
#
Links::init_date(); ## you can either 'use GT::Date' or do it this way, this is probably better
GT::Date::date_set_format('%ddd% %mmm% %dd% %yyyy%'); ## this is the key to making it work
my $LINK_DB = $DB->table('Links');
my $link = GT::Template->tags; ## load the template tags -- change in Links 2.1 parser
$link->{'Days_Old'} = GT::Date::date_diff ( GT::Date::date_get(), $link->{'Add_Date'});
if ($link->{'Days_Old'} > $CFG->{'build_new_cutoff'}) { ## if the link is not supposed to be "new"
if ( ($link->{isNew} eq 'Yes') or ($link->{isNew} == 1) ) { ## flags are wrong
$LINK_DB->update ( ## reset the flags
{
isNew => 'No'
},
{
ID => $link->{'ID'}
}
);
}
$link->{'isNew'} = '0';
$link->{'Days_Old'} = '0'; ## might need to delete $link->{'Days_Old'} in some cases.
} else { ## the link is IS NEW, so check it.
if ( ($link->{isNew} eq 'No') or ($link->{isNew} == 0) ) { ## flags are wrong
$LINK_DB->update (
{
isNew => 'Yes'
},
{
ID => $link->{'ID'}
}
);
}
$link->{'isNew'} = '1';
$link->{'Days_Old'} = '1'; ## might need to delete $link->{'Days_Old'} in some cases.
}
## return the data
return ($link); #fixed typo
}
If this works, I'll update the .pm file above. (The file above works for me.... and that's what *really* counts <g>)
PUGDOG� Enterprises, Inc. The best way to contact me is to
NOT use Email.
Please leave a PM here.