[pmwiki-users] $EnablePageTitlePriority

Petko Yotov 5ko at 5ko.fr
Thu Feb 3 08:51:58 CST 2011

On Thursday 03 February 2011 04:30:57, ABClf wrote :
> I'm struggling with $EnablePageTitlePriority
> Set to 1 in my config php, but has no effect :
> page included's title wins and gives its title to host page
> (pmwiki 2.2.23)

The main page should have a (:title ...:) directive. If it doesn't have it, a 
directive from an included page can set the title.

> Can someone confirm
> $EnablePageTitlePriority = 1; # First title wins; if a title is
> defined in the page, directives from included pages cannot change it.
> it's still working as expected without trouble ?

It should be expected to work.

> I'm almost sure, (in some cases, see infra), it doesn't work for me ;
> but (code extracted from http://www.pmwiki.org/wiki/PITS/00266)
> Markup('title','directives',
>   '/\\(:title\\s(.*?):\\)/ei',
>   "IsEnabled(\$GLOBALS['PCache'][\$pagename]['=p_title'], false)>''?
> '': PZZ( PCache(\$pagename,
>          \$zz=array('title' => SetProperty(\$pagename, 'title',
> PSS('$1')))) )");
> does work in any case I guess.

Not exactly - this would set the title to the first (:title:) directive which 
could be in an included page like a GroupHeader. These PITS pages should 
probably be cleaned up.

> In fact,
> $EnablePageTitlePriority = 1; # First title wins;
> works or doesn't work *depending the skin being used* (changes are
> done with ?setskin=pmwiki) :
> using pmwiki default skin, $EnablePageTitlePriority = 1; works as
> expected : first title wins
> using some other personal skin, $EnablePageTitlePriority = 1; doesn't work.

I don't think it is something related to the skin, when the skin is loaded, 
the page markup has already been processed and the title has been set. 

It could be more something like config.php or a recipe using the function 
MarkupToHTML(), PageVar() or PageTextVar() directly before the main page text. 
Or it could be you or a recipe forcing the inclusion of stdmarkup.php before 
you have set the $EnablePageTitlePriority variable.

> What is the difference between the code used for
> $EnablePageTitlePriority and the extracted code quoted in my text
> Markup('title','directives', (etc) ?
> I tried to compare stdmarkup in 2.2.8 / 2.2.9 and didn't understand
> anything ; differences are slightly, involving some $tmpkeep and
> $tmpwhen variables that don't come back in 2.2.9 stdmarkupfile.

$EnablePageTitleProirity controls two parameters: when the (:title...:) markup 
is processed to set the title, and if an existing title should be kept or 
- The default PmWiki way always was to process the directive after all pages
  have been included, and to override an existing title.
- The new core way can be enabled to process the directive before including
  pages (and after) but to keep an existing title. If a page defines a title,
  an included page or a GroupHeader will not change it.

The order of the two ways is outlined here:

- The two code snippets on the PITS page process the directive after includes,
  and keep existing titles. The first directive wins, and it could come from a

> At this time, I'm using the pits code ; next, I will have to redo my
> skin, keeping an eye on how included title work.
> But I would like to understand, if possible, why can some template
> have an effect on $EnablePageTitlePriority.

I don't think it is a skin template, but I could be wrong. If you have a skin 
that breaks the title, I'd like to test it.


More information about the pmwiki-users mailing list