Extension talk:CustomTitle
What's the need and function?
- SEO. --LauraHale 00:45, 21 May 2009 (UTC)
Contents |
[edit] Characters not Allowed
It seems that if you have a custom 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?
[edit] 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 <title> on on certain pages? Is there an alternative?
[edit] 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\>)(.*)(\<\/title\>)#e";
$customtitle = $this->customPageTitle;
$title = "'<title>'.'$customtitle'.'</title>'";
$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)
[edit] 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)
[edit] 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() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: '<title>'.'- My title here'.'</title>' 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.