[pmwiki-users] Trying to add new page variable problem

Ed W lists at wildgooses.com
Tue Feb 24 06:07:40 CST 2009


Hi

Peter Bowers wrote:
> On Mon, Feb 23, 2009 at 9:36 PM, Ed W <lists at wildgooses.com
> <mailto:lists at wildgooses.com>> wrote:
>
>     Given that the goal is to enhance the sitemap.php recipe to support:
>
>     ...
>     How best should I design my markup so that I can scan for these
>     things.
>
>
> Use PTVs.  The name of the variable is something consistent across all
> pages so you can scan for it.  If it doesn't exist then you have some
> appropriate default chosen.

This seems like a sensible choice - I just thought it seemed at odds
with some of the other page markup, but it does seem simpler at least
 
>
>     Assuming you recommend instead using pagevars rather than writing vars
>     to the page file, can you perhaps spend a few seconds explaining the
>     ReadVar function and how it picks out the pagevars because it's rather
>     alluding me how it actually functions right now...
>
>
> Er...  Where are you finding the ReadVar function?  Do you mean
> PageVar()?  Why not just use the function as it stands?  You can do a
> quick CondAuth() ahead of time if you need to check authorizations...

Yes, sorry, PageVar()

However, my reading of this function is that PageVar uses ReadPage *iff*
the page is a reference to a page in another group (or at least that's
how I read that regexp in the middle).  For everything else it's going
to cascade into PageTextVar, which then uses the read function
"RetrieveAuthPage" which respects read authentication.  This would
appear to mean that I couldn't read the text vars for pages that don't
have open read permissions?


> If you do need to understand the internals of PageVar or PageTextVar
> try putting in some of those echo statements I recommended earlier,
> figure out the majority of it, and if you have specific questions go
> ahead and post them.

I think I can now see that the key function is just that loop which does
the preg_replace which seems to be slicing out all text vars which match
a pattern

In my case I guess I can just to an exact regexp match looking for the
stuff I want on each page!

Q: Are there any meta functions for investigating of any named markup
exists on a given page? ie instead of me hardcoding the regexp to see if
there is any "(:redirect:)" markup on a page is it possible to ask
pmwiki what the redirect markup looks like and if there is any on this page?

Thanks

Ed W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090224/b41f29d1/attachment.html 


More information about the pmwiki-users mailing list