[pmwiki-devel] markup order for group headers

marc gmane at auxbuss.com
Mon Jan 29 14:44:46 CST 2007


Patrick R. Michaud said...
> 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.

Yes, they are. I used that as an example of showing that the page markup 
function was being performed before the group header markup function. 
There is no useful purpose in doing this other than as a debugging aid.

The reason is that, ultimately, I would like to populate the array in 
the Site or Group Header prior to displaying the dropdown on the page.

> > 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.

(:auxselectdata:) is 'inline' whereas (:auxselect:) is '<directives', 
since it outputs directives.

> > 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.

I don't think I was doing that. I simply made a deduction from the 
evidence.

Now, regarding the detailed processing of PmWiki pages, I am always 
eager to learn.

> 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.

Understood.
 
> 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).

(:auxselectdata:) doesn't overwrite the array - that's why I chose it 
here. The first call to an array populates it, subsequent calls cause an 
error:

    if (isset($AuxSelectData[$arrayname]))
        return 'Cannot overwrite existing array';

> 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.

Where in the order of things are (:include:)s processed?
 
> 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).

I hope that I've provided what you need above. I understand the 
processing constraints a lot better now, but I'm not sure where the 
(:include:) markups are in the order of things.

Thanks very much for the background.

-- 
Cheers,
Marc




More information about the pmwiki-devel mailing list