[pmwiki-users] Great pagelist question...
Patrick R. Michaud
pmichaud at pobox.com
Wed Aug 30 09:00:36 CDT 2006
On Wed, Aug 30, 2006 at 08:44:14AM -0400, The Editor wrote:
> After thinking about it more though, parameterizing $DataValue may be
> the best way to go, though I'm not sure exactly what you mean by it.
> I take it you are saying we can somehow set the page variables as an
> array based on Group.Name. (Actually this is a MUCH better--as it
> allows much greater flexibility).
Yes, this is exactly what the Cookbook does, so that
{Cookbook.XYZ$RecipeSummary}
retrieves the "Summary:" line from the Cookbook.XYZ page,
as opposed to {$RecipeSummary} which retrieves the "Summary:"
line from the current page. They're all held in arrays based
on the page's full name.
And this allows a pagelist template to use {=$RecipeSummary}
to easily grab the "Summary:" lines from all of the pages
in the list.
I'll need to look at your code a bit more. PmWiki's approach
up-to-now has been to store special values as separate page
attributes, to potentially make it easier to do searches/sorts
and avoid re-scanning the entire markup text of each page for each
page variable. But there's something to be said in favor of
scanning it directly from the markup for a given pattern.
I may also want to incorporate some ideas from the HttpVariables
recipe, although I'm not sure I agree with the exact syntax used there.
> If I'm on the right track, then the pagelist template might look
> something like the following
>
> [[#forum]]
> (:data ={=$FullName} :)
> * [[ {=$FullName} | {$DataValue[{$FullName}]} ]] // can you put one
> page var in another?
> [[#forumend]]
No, I'm thinking that the pagelist template ought to look
something like:
[[#forum]]
* [[ {=$FullName} | {=$:DataValue} ]]
[[#forumend]]
where the $: is a special page variable marker that says
"get the value of 'DataValue'" from the appropriate page.
Thus we have:
{$:DataValue} -- DataValue in current page
{Cookbook$:DataValue} -- DataValue in Cookbook page
{=$:DataValue} -- DataValue of current page in pagelist
BTW, this is a useful enough approach that I'm reserving this
particular markup for PmWiki to eventually use.
And I should note that recipe authors should be careful about
introducing too many specialized variations on the page variable
markup -- the core distribution may grab some of them for
other purposes at some point.
Pm
More information about the pmwiki-users
mailing list