Extension talk:CustomTitle

What's the need and function?


 * SEO. --LauraHale 00:45, 21 May 2009 (UTC)

Characters not Allowed
MediaWiki allows creation of pages with an apostraphe in it. But if you use this extension to create a title with an apostrophe ' and you try and save the page, you get an error page. Why can't we have apostrophes in the title? Is there any way to allow them? --Holygamer (talk) 18:39, 17 March 2012 (UTC)

Title not work with 1.16.0
I tested it with 1.16.0. The page title part worked well, but it seems do nothing to header title tag.


 * How do I change the tag on on certain pages? Is there an alternative?

Modification that works with 1.16.0
A small trick that does the job with 1.16.0: function onSkinTemplateOutputPageBeforeExec(&$m_skinTemplate, &$m_tpl) {       if (isset($this->customTitle)) $m_tpl->set('title', $this->customTitle); if (isset($this->customPageTitle)) { $m_tpl->set('pagetitle', $this->customPageTitle); $text = $m_tpl->data['headelement']; $regex = "#(\)(.*)(\<\/title\>)#e"; $customtitle = $this->customPageTitle; $title = "' '.'$customtitle'.' '"; $text = preg_replace($regex,$title,$text); $m_tpl->set('headelement', $text); }       return true; } 79.86.134.104 15:00, 1 March 2011 (UTC)
 * Works in 1.17.0 --Netsu 16:03, 8 September 2011 (UTC)


 * This works in 1.18.0 too, thanks for the help! Cheers, --Till Kraemer 12:10, 12 December 2011 (UTC)


 * Don't work (in 1.19, probably others) when there is a single quote in title. See post below. Tintinux - 18:00, 28 January 2013 (UTC)

How to remove the customtitle text (xxx-CustomTitleStart-xxx) from appearing in search results
This is a very important extension that I can't operate without it in my website. However, although it does modify the title of the page to what i want it to appear. in search results the cache of all my pages has "xxx-CustomTitleStart-xxx". this happenes whther I put it in template or standalone, the cache of pages will have that which appears first in description during search results. Can someone please let me know a work around or if this can be fixed?

Thank You Wikimanz 09:20, 16 October 2011 (UTC)

Parse error: syntax error CustomTitle.php on line 66
Sometimes after adding the customtitle start I get this error.

Parse error: syntax error, unexpected T_STRING in /home/........../extensions/CustomTitle.php(66) : regexp code on line 1

Fatal error: preg_replace [function.preg-replace]: Failed evaluating code: '&lt;title&gt;'.'- My title here'.'&lt;/title&gt;' in /home/.............../extensions/CustomTitle.php on line 66

Can someone address this issue, It has happened to me, not often but occassionally but this could be a bug or something that others may experience as well.

HTML tags? Or formatting?
I want to setup my headers so that there is something in the center then another part on the righthand side. Is this possible? I was thinking of using the html tags for text-align, but html tags do not work. any advice?

Error parsing when Quote in title
With mediawiki 1.19 and the patch for Mediawiki > 1.16 (see above), and a single quote in the title, e.g : there is a fatal error :

Parse error: syntax error, unexpected T_STRING in /**********/mediawiki/extensions/CustomTitle/CustomTitle.php(107) : regexp code on line 1 Fatal error: preg_replace: Failed evaluating code: '' in /**********/mediawiki/extensions/CustomTitle/CustomTitle.php on line 107

It works with this :

function onSkinTemplateOutputPageBeforeExec(&$m_skinTemplate, &$m_tpl) {      if (isset($this->customTitle)) {          $m_tpl->set('title', $this->customTitle); $m_tpl->set('pagetitle', $this->customTitle); $text = $m_tpl->data['headelement']; $regex = "#(\)(.*)(\<\/title\>)#e"; $customtitle = $this->customTitle; $customtitle = str_replace ( "'", "\'", $customtitle ); $title = "' '.'$customtitle'.' '"; $text = preg_replace($regex,$title,$text); $m_tpl->set('headelement', $text); }      return true; }