[Pmwiki-users] Page Title Markup
John Rankin
john.rankin
Thu Apr 1 14:26:43 CST 2004
On Friday, 2 April 2004 7:56 AM, J. Perkins <jason at sim8.com> wrote:
>I'm setting up a new wiki install and I need a markup to set the page
>title, at least in browse mode. Something along the lines of [[pagetitle
>My Title]]. After some googling and looking over the main site I wasn't
>able to turn anything up. Has anyone managed this? I have an idea of how
>it could be done, but it requires a change to pmwiki.php.
>
>Thanks,
>Jason
>
>
>
>--
>Pmwiki-users mailing list
>Pmwiki-users at pmichaud.com
>http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com
>
Well we did a crude but effective local customisation to achieve this:
1. adopt a convention that if a page starts with
!!!Some kind of heading
use this as the title. This has the benefit of not forcing a full
scan of every page to see if it contains a special title markup,
and avoids having to edit existing pages (which may also be a
problem)
2. change your template so that it refers to
$HTMLTitleFmt
instead of spelling out <title> ... </title>
3. add the following to your local/config.php
if ($action=='browse') {
$AltTitle = TitleParagraph($pagename);
if ($AltTitle) $HTMLTitleFmt =
str_replace('$HTMLTitle',$AltTitle,$HTMLTitleFmt);
}
$InlineReplacements["/`\./"]="";
function TitleParagraph($page) {
$refpage = ReadPage($page);
if ($refpage) {
$refpage['text'] = $refpage['text'] . "\n";
if (preg_match("/^!+\\s*(.*?)\\n/", $refpage['text'], $match)) $para =
preg_replace("/`\\..*?$/","...",$match[1]);
}
return $para;
}
This also lets you truncate long titles with `. (stop) markup
4. (optional enhancement) You could use a special start of page markup,
like
=title Your Title here
and $DoubleBrackets the "^=title" into some fixed number of !
Hope this helps :)
--
JR
--
John Rankin
More information about the pmwiki-users
mailing list