[pmwiki-users] Page List

Hans design5 at softflow.co.uk
Sun Mar 18 16:28:11 CDT 2007


Sunday, March 18, 2007, 9:01:23 PM, Stealth wrote:

> like i want to set it so my page list only displays the next 10 days
> worth of stuff from today. the page title is in a yyyymmdd format. so
> alphabetical list sorts them correctly. but it sorts them all and only
> from the top, i want them to knock off the top of the list as the day
> passes, the only other way i can think of is to do a "today" variable
> for the next 10 days, bit of a clumsy way to do it.. but will be my only
> choice if there is no alternative.

you can try this:

install the conditional extension recipe, to get numeric comparisons
for conditionals.

Then create a fmt for your pagelist :

for instance this fmt=#entries will display (include in this case)
all pages from today. If you don't want to include page contents, but
display links, substitute for the links markup in this:

>>comment<<
[[#entries]]
(:if ge {=$Name} {$TodayDate}:)
!!![[{=$Name}]]
(:include {=$FullName}:)(:if:)
[[#entriesend]]
>><<

you need also define in config.php the page variable $TodayDate:
so for config:

# add Pagevariable {$TodayDate} in form yyyymmdd
$FmtPV['$TodayDate'] = 'strftime("%Y%m%d", time() )';

# add Conditional Extensions
include_once("$FarmD/cookbook/extendcond.php");

if you want only the next 10 days, you need to define another PV
for ten days ahead, call it perhaps $TenDaysDate, by perhaps adding
the right number of seconds to the time():
time()+10*24*60*60 might do:

# add Pagevariable {$TenDaysDate} in form yyyymmdd
$FmtPV['$TenDaysDate'] = 'strftime("%Y%m%d", time()+10*24*60*60 )';

With this you could have  a page fmt like this:

>>comment<<
[[#entries]]
(:if eval ge {=$Name} {$TodayDate} && le {=$Name} {$TenDaysDate} :)
!!![[{=$Name}]]
(:include {=$FullName}:)(:if:)
[[#entriesend]]
>><<

I have not tested this last conditional. It may need some careful
bracketing.

Hans




More information about the pmwiki-users mailing list