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

Hans design5 at softflow.co.uk
Sun Jul 13 12:31:44 CDT 2008


Sunday, July 13, 2008, 5:18:21 PM, stevecrisp at gmail.com wrote:

> On yours Hans I get the red background, great, however its on all my
> pagelist items.  If I play with the def for $WeekAgo and $MonthAgo
> e.g. week I set to one day and month to 5 days they are still all red
> (see below from my config.php).

Not sure what goes missing. Perhaps you need full color codes:
instead of #fcc use #ffcccc etc for the others.
Also for testing you could put some text inside the item divs, so it is
not just the background identifying each section:

(:if gt {=$ModTime} {$WeekAgo}:)
>>bgcolor=#ffcccc<<Last week:
(:elseif gt {=$ModTime} {$MonthAgo}:)
>>bgcolor=#ffeedd<<Last month:
(:else:)
>>bgcolor=#eeeeee<<Older
(:ifend:)


Here is another variation, the config settings are the same as before.
I added subtitles, and changed the format a little.

>>width=60pct border='1px solid #ccc' padding=3px<<
!!!Recent Articles
(:pagelist group=Test fmt=#colorblocks :)
>><<

(:if1 false:)
[[#colorblocks]]
(:template defaults order=-time list=normal:)
(:template first:)
(:if gt {=$ModTime} {$WeekAgo} ):)
>>bgcolor=#ffffff<<
!!!!Last week:
>><<
(:ifend:)
(:template each:)
(:if expr ( ( gt {<$ModTime} {$WeekAgo} ) &&  ( lt {=$ModTime} {$WeekAgo} ) ) :)
>>bgcolor=#ffffff<<
!!!!More than a week ago:
>><<
(:if expr ( ( gt {<$ModTime} {$MonthAgo} ) &&  ( lt {=$ModTime} {$MonthAgo} ) ) :)
>>bgcolor=#ffffff<<
!!!!More than a month ago:
>><<
(:if gt {=$ModTime} {$WeekAgo}:)
>>bgcolor=#ffd9d9 padding='0 5px' border-bottom='1px solid #fff'<<
(:elseif gt {=$ModTime} {$MonthAgo}:)
>>bgcolor=#ffeedd padding='0 5px' border-bottom='1px solid #fff'<<
(:else:)
>>bgcolor=#eeeeee padding='0 5px' border-bottom='1px solid #fff'<<
(:ifend:)
||[[{=$FullName}|+]] || &nbsp;[-  (:if !equal {=$LastModifiedBy} '':) by [[~{=$LastModifiedBy}]](:if:) on {(ftime '%d %B %Y' @{=$ModTime} )}-]||
>><<
[[#colorblocksend]]
(:if1end:)



  ~Hans




More information about the pmwiki-users mailing list