joomla - 在 Joomla! 中设置页面标题3 来自模块

标签 joomla joomla3.0 joomla-extensions

我有一个现有模块,我使用 {loadposition custom_position} 从一篇文章中显示它。文章链接到菜单项。我希望能够从此模块设置自定义页面标题,覆盖菜单项设置的页面标题。

我试过用

$document = JFactory::getDocument();
$document->setTitle('Set your title here');

但它没有设置页面标题。

是否可以在模块内设置页面标题,还是只能在组件内完成。

最佳答案

你写的代码是正确的,但是可能其他模块/插件在你改了之后改了标题。

您可能希望在设置标题后立即回显,例如

$document = JFactory::getDocument();
$document->setTitle('Set your title here');
echo "<h1>" . JFactory::getDocument()->getTitle() . "</h1>";

如果这是正确的,你需要寻找其他模块/插件来改变它。

关于joomla - 在 Joomla! 中设置页面标题3 来自模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31454079/

相关文章:

redirect - 在 joomla virutemart 付款过程完成后如何找到响应?

joomla - 禁用用户个人资料编辑?

jquery - div底部的对齐按钮

php - 将 2.5 joomla 升级到 joomla 3.0 组件未找到错误

joomla - 基于语言的安装描述

php - Joomla 输入表单字段输出

css - Joomla 在文章中添加 &lt;style&gt;

ssl - Joomla 禁用 SSL 管理员登录

css - Joomla 的 Favslider 插件仅在 Google Chrome 中无法在 IE 或 Firefox 中调整图像大小

joomla - 清理 joomla 中的输入