[pmwiki-devel] markup order for group headers
Patrick R. Michaud
pmichaud at pobox.com
Mon Jan 29 13:02:17 CST 2007
On Mon, Jan 29, 2007 at 06:43:29PM -0000, marc wrote:
> Patrick R. Michaud said...
> > If you're talking about the GroupHeader pages, then no, they're
> > run at the same time as page's markup. In fact, GroupHeader effectively
> > works by adding the equivalent of
> > (:include GroupHeader:)(:nl:)
> > to the beginning of the page text before processing the markup.
> > (The actual text to be prepended is given by $GroupHeaderFmt.)
>
> So, say, in GroupHeader I have
>
> (:auxselectdata test2 1 2 3':)
> (:auxSelect test2 test2 text='GroupHeader: ':)
>
> The first markup basically does:
>
> $AuxSelectData[test2] = array(1,2,3);
>
> while the second displays the dropdown, populated with $AuxSelectData
> [test2]
>
> That works (in the GroupHeader) and displays above page text, as normal.
>
> Now, when I add the same markup to the page (but use, say
> (:auxselectdata test2 4 5 6':) to distinguish it), ...
How is this second one "distinguished" from the first? To me they
look as though they are both doing the same thing -- i.e., setting
values for $AuxSelectData.
> the function the
> markup calls issues an error stating that an existing array cannot be
> overwritten (I do this as a security measure). But the error is raised
> within the GroupHeader. This is confirmed by the fact that both the
> dropdown on the page and in the header contain the population data from
> the page - 4,5,6 in this case.
What's the value of the $when parameter that is being used
for the (:auxselectdata:) markup? That's critically important here.
> I can extend this to include SiteHeader and exactly the same thing
> happens.
>
> IOW, the function called by (:auxselectdata:) in the page is being
> called before both the Group and Site headers.
It's a mistake to assume that PmWiki processes pages and headers
separately. What happens is that the Group and Site headers are
inserted into the text of the page (via (:include:)) as the page
is being processed.
So, if all of the (:auxselectdata:) directives
are being processed before any of the (:input:) directives,
then each (:input:) directive is simply seeing the results of
the last (:auxselectdata:) directive encountered (i.e., the one
that is in the page, which replaced any values set by the ones
in the Group and Site).
And if the (:auxselectdata:) directive is processed before
(:include:) directives are processed, then yes, the page's values
will be evaluated first, followed by the group and site values.
So, it all comes back to the question of when the (:auxselectdata:)
markup is being processed in relation to the other (:input:) markups
(and possibly the (:include:) markups as well).
Pm
More information about the pmwiki-devel
mailing list