I've got a crude, but working version of the Perl Days_Old plugin working for using a graphic to represent new links. (As an aside, I've always wondered why this isn't built into Links as a standard feature, since it seems to be quite popular and a natural extension of the "new" superscript titles.)
I haven't done it yet for categories, just links at this point, but it should be pretty similar. In Utils.inc.php, function _print_link(), I added the following just after if (!isset($opts['return_as_string'])) at the top (before the function makes display preference adjustments to some of the necessary values:
$add_date = explode("-", $link['Add_Date']);
$add_stamp = mktime(12, 0, 0, $add_date[1], $add_date[2], $add_date[0]);
$today_stamp = mktime(12, 0, 0, date("m, d, Y"));
$link['Days_Old'] = ($today_stamp - $add_stamp) / (24*60*60);
} else {
$link['Days_Old'] = '';
}
Then in link.html, you can use $Days_Old to represent the number of days old a link is, such as to assign a graphic to it corresponding to the number. For example:
<img src="/images/new<?echo $Days_Old?>.gif">
<?}?>
It looks like a similar treatment to function _print_cat() right below it will handle the categories, but I haven't yet tested that.
There aren't any built in functions for the PHP front end like GT::Date::date_diff (sub date_diff{} in Date.pm), are there?
Dan
I haven't done it yet for categories, just links at this point, but it should be pretty similar. In Utils.inc.php, function _print_link(), I added the following just after if (!isset($opts['return_as_string'])) at the top (before the function makes display preference adjustments to some of the necessary values:
Code:
if ($link['isNew'] == 'Yes') { $add_date = explode("-", $link['Add_Date']);
$add_stamp = mktime(12, 0, 0, $add_date[1], $add_date[2], $add_date[0]);
$today_stamp = mktime(12, 0, 0, date("m, d, Y"));
$link['Days_Old'] = ($today_stamp - $add_stamp) / (24*60*60);
} else {
$link['Days_Old'] = '';
}
Then in link.html, you can use $Days_Old to represent the number of days old a link is, such as to assign a graphic to it corresponding to the number. For example:
Code:
<?if ($isNew) {?> <img src="/images/new<?echo $Days_Old?>.gif">
<?}?>
It looks like a similar treatment to function _print_cat() right below it will handle the categories, but I haven't yet tested that.
There aren't any built in functions for the PHP front end like GT::Date::date_diff (sub date_diff{} in Date.pm), are there?
Dan