[pmwiki-users] pagevariable for creation time

Patrick R. Michaud pmichaud at pobox.com
Wed May 9 15:58:49 CDT 2007


On Wed, May 09, 2007 at 03:24:26PM -0500, Jon Haupt wrote:
> On 5/9/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> >My best guess at the moment is one of:
> >    {$LastModifiedISO}            # output form yyyy-mm-ddThh:mm:ss
> >    {$CreatedISO}
> >or
> >    @{$mtime}                     # output as @1178735110
> >    @{$ctime}
> >
> 
> I like the {$CreatedISO} example.  It's easy to figure out what that
> means, and what's displayed makes sense given the variable name.  

The downside of {$CreatedISO} is that it means that PmWiki is
constantly converting times between ISO format and timestamps.
The @1178735110 formats don't have that issue.

Perhaps {$CreatedTime} and {$LastModifiedTime} would be
workable for the timestamps.

> The reason this came up, incidentally, is that I have been thinking about
> the way we add tons of page variables for different date formats for
> BlogSimple and BlogSimple2, and how nice it would be to just have one
> PV {$CreatedISO} that could be formatted in many ways on the fly using
> {(ftime)}.  I tried to create such a page variable, but couldn't
> figure out how to do it right.

The date converter in the latest beta doesn't yet know how to deal
with any 'Thh:mm:ss' portion of ISO formatted dates, it only
parses the date portion.  I can see about adding times to the mix.

But this is another argument in favor of the @nnnn syntax as
input to {(ftime)}.

At any rate, if you want to play with it as a local customization,
you could do:

    $FmtPV['$LastModifiedTime'] =  "\$page['time']";
    $FmtPV['$CreatedTime'] =       "\$page['ctime']";

Then to use it in {(ftime)} markup:

    {(ftime %F @{$CreatedTime})}       # creation date as yyyy-mm-dd

Pm



More information about the pmwiki-users mailing list