[pmwiki-users] Conditional Markup question

Patrick R. Michaud pmichaud at pobox.com
Thu Jun 15 14:48:53 CDT 2006


On Thu, Jun 15, 2006 at 03:18:26PM -0400, David Spitzley wrote:
> >>> "Patrick R. Michaud" <pmichaud at pobox.com> 06/15/06 2:37 PM >>>
> On Thu, Jun 15, 2006 at 02:12:14PM -0400, David Spitzley wrote:
> > I'm trying to create a pagelist format that will append "- New" 
> > to the end of any item with a create date less than 30 days old.  
> > Any suggestions on how to do that?
> 
> Easiest is probably to create a custom page variable for it.
> 
>     $FmtPV['$New'] = 
>       '($page["ctime"] > time() - 30 * 86400) ? "- New" : ""';
> 
> Then, in the template you can use {=$New}.  This will display
> "- New" for any page created within the past 30 days, or ""
> for any page that is 30 days or older.
> ----------------
> 
> Ok, I've done that, but now that I've created the new format in Site.LocalTemplates, the pagelist that calls it generates no results, while using fmt=title still works.  Here's my format statement:
> 
> !!!fmt=#newtitles
> [@
> [[#newtitles]]
> * [[{=$FullName}|+]] {=$New}
> [[#newtitlesend]]
> @]
> 
> 
> Is there anything obviously wrong?  

Well, let's make sure the {$New} markup is working.  Try creating
a page that contains the {$New} markup somewhere in it -- if it's
a new page, you should see "- New" as the page contents.  If that
works, then it's something about pagelist; if it doesn't work, then
there's a problem in the code I gave you.

Pm




More information about the pmwiki-users mailing list