How to use first bolded words/phrase as WikkaWiki title
Posted by Vincent Isles at Sunday, March 08, 2009One of the things I love about MediaWiki is the ability to use the first bolded word or phrase as the page title. Since MediaWiki is too slow for shared hosts, such as the one hosting the Encyclopedia of Philippine Education, I could not use MediaWiki, and instead I opted for the less resource-hungry WikkaWiki. With WikkaWiki, the default title is the first word or phrase which is made into a header. In order to change this behavior, we have to change the file lib/Wakka.class.php. Find the following code snippets:
function PageTitle() {
$title = "";
$pagecontent = $this->page["body"];
if (ereg( "(=){3,5}([^=\n]+)(=){3,5}", $pagecontent, $title)) {
$formatting_tags = array("**", "//", "__", "##", "''", "++", "#%", "@@", "\"\"");
$title = str_replace($formatting_tags, "", $title[2]);
}
if ($title) return strip_tags($this->Format($title)); # fix for forced links in heading
else return $this->GetPageTag();
}
We have two things to change:
1. The ereg value - instead of the one given, it should be ereg( "\*\*([^=*\n]+)?\*\*", $pagecontent, $title)
2. The $title should be then be $title = str_replace($formatting_tags, "", $title[1]); // take note of the [1], from [2].

