Menu item title overriding setTitle in module(菜单项标题覆盖模块中的 setTitle)
问题描述
我遇到过在菜单管理器中 Joomla 后端指定的菜单项标题覆盖以下调用的情况:JFactory::getDocument()->setTitle('Custom title')代码>
I've encountered a scenario where the menu item Title specified on the Joomla back-end in Menu Manager overrides the following call: JFactory::getDocument()->setTitle('Custom title')
文档的标题变为自定义标题",直到 components/com_content/views/article/view.html.php
中的以下几行:
The document's title becomes 'Custom title' up until the following lines in components/com_content/views/article/view.html.php
:
if (empty($title)) {
$title = $this->item->title;
}
$this->document->setTitle($title);
我为模块中的文档指定了一个新标题:
I assign a new title to the document in my module:
JFactory::getDocument()->setTitle('New title');
如何阻止 Joomla 覆盖我在模块中提供给文档的文章?
How can I stop Joomla from overwriting the article I gave the document in my module?
推荐答案
You Can Use Javascript from your module:
You Can Use Javascript from your module:
如果此代码对您有帮助,请注意我:)
Note me Please If This Code Helps you :)
JFactory::getDocument()->addScriptDeclaration("
window.onload=function(){
changeTitle('New Title')
}
function changeTitle(newTitle){
document.title=newTitle;
}
");
这篇关于菜单项标题覆盖模块中的 setTitle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:菜单项标题覆盖模块中的 setTitle


基础教程推荐
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01