[pmwiki-users] A standard way to set the html-header "title"

Hans design5 at softflow.co.uk
Fri Nov 24 04:30:24 CST 2006


Thursday, November 23, 2006, 9:30:02 PM, Stirling wrote:

> I agree completely, I modified my copy of the Triad skin so that it just had

>   $WikiTitleFmt

> instead of the default <title>...</title> in the skin and put this into the
> skin.php:

>   $FmtPV['$WikiTitle'] = '$GLOBALS["WikiTitle"]';
>   $FmtPV['$WikiTitleFmt'] = '$GLOBALS["WikiTitleFmt"]';

>   SDV($WikiTitleFmt,"<title>\$WikiTitle - \$Group - \$Title</title>");

> That way each time I use this skin, I can change what format a title has.

I think this is a good idea, and will incorporate it in the next skin
updates (FixFlow, Gemini, Triad), but modified as shown below.
I would rather call it $HTMLTitleFmt, in line with the
HTMLHeader. And there is no need to remove the <title> ... </title>
tags from the skin template, since they are in any way necessary for a
HTML document. Also I don't see the need to make HTMLTitleFmt available
as a page variable.

So I suggest to put in the skin template:

<title>$HTMLTitleFmt</title>

and put in skin.php:

// set HTML Title
gobal $HTMLTitleFmt, $WikiTitle;
$group = PageVar($pagename, '$Group');
$title = PageVar($pagename, '$Title');
SDV($HTMLTitleFmt, "$WikiTitle - $group - $title");

or better still, since the group may have a GroupTitle set:
SDV($HTMLTitleFmt, "$WikiTitle - $GroupTitle - $title");

(I just recently added a switch to the skins to use any GroupTitle
if present)

Note that if you wish to define $HTMLTitleFmt in config.php,
you would need to retrieve values for $Group  and $Title first,
since they change from page to page.

Hans





More information about the pmwiki-users mailing list