2014-07-21 41 views
3

我遇到地方上的菜单管理Joomla的后端指定的菜单项标题的场景将覆盖以下电话:JFactory::getDocument()->setTitle('Custom title')菜单项标题覆盖的setTitle

文档的标题变成了“自定义标题”起来直到components/com_content/views/article/view.html.php下面几行:

if (empty($title)) { 
    $title = $this->item->title; 
} 
$this->document->setTitle($title); 

我我的模块中分配一个新的标题文件:

JFactory::getDocument()->setTitle('New title'); 

^h我能否阻止Joomla覆盖我在模块中提供文档的文章?

+0

可能要检查与乡亲http://joomla.stackexchange.com/问题 – GDP

+0

还有类似的问题:http://stackoverflow.com/q/31454079/1983389 –

回答

1

你可以从你的模块使用JavaScript:

注意我请If此代码可以帮助你:)

JFactory::getDocument()->addScriptDeclaration("  
     window.onload=function(){ 
      changeTitle('New Title') 
     } 

     function changeTitle(newTitle){ 
      document.title=newTitle;    
     }  
    ");