[pmwiki-users] pagelist with ctime?
Petko Yotov
5ko at 5ko.fr
Tue Dec 15 02:24:03 CST 2009
On Monday 14 December 2009 23:15:58 Holger Kremb wrote:
> I just tried to generate a pagelist to find out new pages from the current
> month. Unfortunately I was not successful. I am not sure but it should be
> possible with ctime.
Hello. Yes, it is possible, with some tweaking.
Define in config.php two new PageVariables :
# add page variable {$PageCreationDate} in format yyyy-mm-dd
$FmtPV['$PageCreationDate'] = '@strftime("%Y-%m-%d", $page["ctime"])';
$FmtPV['$PageCreationMonth']= '@strftime("%Y-%m",$page["ctime"])'; #optional
Then, use in a pagelist:
(:pagelist trail=Site.AllRecentChanges order=-$PageCreationDate
if="exists {=$FullName}" count=30:)
Or, in a standard searchbox, just :
order=-$PageCreationDate (note that on a large site it may be slow)
The "if=" part is to exclude deleted pages.
You can also use the $PageCreationMonth variable to test for the current
month:
(:pagelist trail=Site.AllRecentChanges
if="equal {=$PageCreationMonth} 2009-12":)
In a pagelist template, you can use {=$PageCreationDate} and
{=$PageCreationMonth} to display these dates for each page in the pagelist.
Here are some useful links explaining what we did :
http://www.pmwiki.org/wiki/PmWiki/PageVariables
http://www.pmwiki.org/wiki/PmWiki/PageLists
http://www.pmwiki.org/wiki/PmWiki/PageListTemplates
Thanks,
Petko
More information about the pmwiki-users
mailing list