[pmwiki-users] pagelists and pagevariables
Hans
design5 at softflow.co.uk
Mon Aug 31 03:28:09 CDT 2009
Monday, August 31, 2009, 7:25:40 AM, Joel Cropley wrote:
> I want to use the pagelist markup to automatically generate lists of
> pages on the wiki, exactly like using the Title page variable and
> fmt=#title. However, I'd like to use more than just the Title page
> variable, say, adding one for serial numbers. It would seem that adding
> $FmtPV['$serialnumber'] ='@$page["serialnumber"]';
> to config.php aught to work, but with (:serialnumber 014:) in the page
> markup, even using {PageName$serialnumber}doesn't return a value. What
> am I missing? Once I get the pagevariable to report correctly, I was
> planning on using
> [[#bynumber]]
> (:template defaults order=serialnumber:)
> * [[{=$serialnumber}|+]]
> [[#bynumber]]
You could use a page text variable (PTV) in each page to hold a
serial number, for instance:
(:serialnumber: 014:)
you could then use {=$FullName$:serialnumber} as a variable in your pagelist
template. You could also use order=$:serialnumber in your template,
or in
(:template defaults order=$:serialnumber:)
But note that the ordering by a PTV is done alphabetically, not
numerically. So that should work with serialnumbers like 014, having
a leading zero. Otherwise you need a custom order function:
http://www.pmwiki.org/wiki/Cookbook/CustomPagelistSortOrderFunctions
If you want to have a serial number added automatically when the page
gets created, via a page template, you can use a markup expression
for that, for instance {(serialname)} or {(serial)} from PowerTools
http://www.pmwiki.org/wiki/Cookbook/PowerTools#serialname
You could then either use it as a PTV, or as the pagename, creating
serialised page names, and using the (:title :) markup for the human
readable title.
With serialised page names the default order in pagelists would work,
and you use fmt=#title to display the titles, all ordered by their
serial pagename numbers.
Hope this helps to get you going!
~Hans
More information about the pmwiki-users
mailing list