=====How to get smarter titles===== >>This is the development-page for smart-titles. It is integrated in Wikka since version 1.1.5.1. To see how it works, take a look at SmartTitlesInfo.>> By default, page titles in Wikka correspond to their WikiName. Although this is consistent with Wiki philosophy, in some cases having a dumb WikiName as a title is pretty limiting: ~-[[WikiName]]s make **""VeryLongTitlesQuiteDifficultToUnderstand""**; ~-They are not an optimal solution for visibility in search engines; ~-They cannot contain accents or other special characters; Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action [[http://www.openformats.org/it | here]]). This action adds to the title the highest-level header available in the page (in this case ##""=====How to get smarter titles===== ""##). If no such header is found, then the standard WikiName is displayed. <page["body"]; for ($i = 2; $i <= 5; $i++) { if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) { $title = str_replace("\"\"", "", $title[2]); } } if ($title) return $title; else return $this->GetPageTag(); } %% Then make the following change in ##actions/header.php## old: %%(php) <?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->AddSpaces($this->GetPageTag()); ?>%% new: %%(php) <?php echo $this->AddSpaces($this->GetWakkaName())." : ".$this->PageTitle(); ?>%% Comments and improvements are welcome -- DarTar ---- Hi DarTar, thanks for sharing this improvement. Your original code didn't give the expected results. It was grabbing **everything** between the first set of ""====="" and the last set. Even the revised fix code seemed to do the same thing. For example on this page, here's what it would return: ''Wikka : How to get smarter titles""====="" By default, page titles in Wikka correspond to their ""WikiName"". Although this is consistent with Wiki philosophy, in some cases having a dumb ""WikiName"" as a title is pretty limiting: ~-""WikiNames"" make ""**VeryLongTitlesQuiteDifficultToUnderstand**""; ~-They are not an optimal solution for visibility in search engines; ~-They cannot contain accents or other special characters; Even though the ""AddSpaces()"" option might partially help, here's a quick and dirty way I figured out to produce smarter titles (you can see a working version of this action ""[[http://www.openformats.org/it | here]]""). This action adds to the title the highest-level header available in the page (in this case ##""=====""How to get smarter titles'' ## DreckFehler: your modification wouldn't seem to work at all. It just kept showing the normal wikiword page title. ups! sorry, i haven't tested the small tweak. it actually didn't much more than the version before. i only changed the pattern [ \t\n\r]+ to \s+ which is virtually the same. anyway, try the following to get a bit closer to the intended behaviour --DreckFehler Below is the regular expression that I came up. It's working, but I'm sure there's room for improvement. %%(php)page["body"]; for ($i = 2; $i <= 5; $i++) { // if (ereg( "(=){".$i."}([A-Za-z0-9 ]*)(=){".$i."}", $pagecontent, $title)) { if (ereg( "(=){".$i."}([^=]+)(=){".$i."}", $pagecontent, $title)) { $title = str_replace("\"\"", "", $title[2]); } } if ($title) return $title; else return $this->GetPageTag(); } ?>%%