Revision [1168]

This is an old revision of Mod040fSmartPageTitles made by JsnX on 2004-09-11 13:11:35.


Wikka Mod 040

Type: Feature Addition


DarTar (main credit for the idea and code)
- DreckFehler (suggestions, comedy and code improvement)
- JsnX (refinement and implementation)

Smart Page Titles


Before this mod, page titles in Wikka corresponded to their WikiName.
Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting:

After this mod, page titles correspond to the first header found in the page. If no header is found, then the page's WikiName is displayed.


Add this code to /wikka.php:
	function PageTitle() {
		$title = "";
		$pagecontent = $this->page["body"];
		if (ereg( "(=){2,5}([^=]+)(=){2,5}", $pagecontent, $title)) {
			$formatting_tags = array("**", "//", "__", "##", "''", "++", "#%", "@@", "\"\"");
			$title = str_replace($formatting_tags, "", $title[2]);
		if ($title) return $title;
		else return $this->GetPageTag();

Then make the following change in /actions/header.php

       <title><?php echo $this->GetWakkaName()." : ".$this->GetPageTag(); ?></title>

       <title><?php echo $this->GetWakkaName()." : ".$this->PageTitle(); ?></title>
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki