[pmwiki-users] Highlight pagelist search results based on time thresholds

Peter Bowers pbowers at pobox.com
Sun Jul 13 05:48:37 CDT 2008

On Sun, Jul 13, 2008 at 9:38 AM,  <stevecrisp at gmail.com> wrote:
> I'd like to be able to highlight pagelist search results based on a
> series on time thresholds.  For example, let's assume hypothetically
> I've set up two time thresholds; the first is 'in the last 7 days',
> the second is 'in the last 30 days'.  I'd like to be able to run a
> pagelist which allowed me to highlight pages that have changed between
> these time thresholds.

Try this...

In Site.LocalTemplates:


A simple bullet list of page names. Colored %red%red%% if within last
7 days, %blue%blue%% if within last 30 days, %green%green%% if older.

* (:if date {$TodayMinus7}..{$TodayYMD}
{=$LastModifiedYMD}:)%red%(:elseif date {$TodayMinus30}..{$TodayYMD}
{=$LastModifiedYMD}:)%blue%(:else:)%green%(:ifend:) [[{=$FullName}]]

in config.php:

$FmtPV['$TodayMinus7'] = '"' . strftime("%Y-%m-%d", $Now-(7*24*60*60)) . '"';
$FmtPV['$TodayMinus30'] = '"' . strftime("%Y-%m-%d", $Now-(30*24*60*60)) . '"';
$FmtPV['$TodayYMD'] = '"' . strftime("%Y-%m-%d", $Now) . '"';
$FmtPV['$LastModifiedYMD'] = 'strftime("%Y-%m-%d", $page["time"])';

on the page where you want your color-coded pagelist:

(:pagelist group=Test fmt=#ColorByDate:)

(Obviously you could change your selection criteria as needed in your
pagelist - it's the fmt=#ColorByDate that will make the difference.)


More information about the pmwiki-users mailing list