[pmwiki-users] Bug in functions PageTextVar or Qualify?

Petko Yotov 5ko at 5ko.fr
Sun Apr 27 06:17:43 CDT 2008


On Sunday 27 April 2008, Hans wrote:
> Sunday, April 27, 2008, 8:55:24 AM, Petko Yotov wrote:
> > This is not a bug but the expected behavior. We are expecting, by
> > convention:
> >
> >   {*$FullName} = the page that is being viewed, even if this piece of
> >       code comes from an included/sidebar/header/footer page.
> >
> >   {$FullName} = the physical page where the code is written, the
> >      included/sidebar/header/footer page if the piece of code is there.
> >      That's why it is expanded to {Group.Page$FullName} as if,
> >      in the page, you wrote it this way yourself.
>
> Sorry to disagree!
>
> {*$FullName} and {$FullName} in the content of a page called
> Group.Page is shown as Group.Page in both cases.
>
> But when loading page text variables with values of
> '{*$FullName}' and '{$FullName}' into an input control
> then no change should take place in both cases. It should be the
> value as written in the page: '{*$FullName}' and '{$FullName}'.
> There should be no substitution, and no Qualify.

I believe the reason for the substitution is that sometimes (often?) it is 
expected to display PTVs from other pages (includes/sidebars/footers...), in 
which case the meaning of {$FullName} would be {Group.Page$FullName}. And, 
this current behavior, which substitutes a wiki markup with an equivalent 
wiki markup, does no harm, as in both cases it should work the same.


> And if Qualify would do a substitution/evaluation of '{*$FullName}'
> and '{$FullName}', i would expect it being in both cases 'Group.Name'.

Qualify skips the conversion of '{*$FullName}' because it is called many 
times, on pieces of text that may be the current page, or may be included.

> But I think it really should not substitute anything, and calling
> PageTextVar for a variable with '{$FullName}' as part of the string
> should not generate '{Group.Page$FullName}'

PageTextVar (and PageVar) is not only used to display PTVs inside form fields, 
but also sometimes to display relative links/PTVs inside (other) pages; this 
is why it prepares the variables.

Also, PageTextVar will cache all PTVs from the page so that in case the same 
or another PTV is needed, it will just return the cached, substituted value. 
This is a speed improvement.

I still don't think this is a "bug", and, except for you writing a filter that 
strips the Group.Page from every {Group.Page$FullName}, I don't see how it 
can be changed (or why should it be). 

But maybe Patrick knows a way to do both things.

Thanks,
Petko







More information about the pmwiki-users mailing list