php 如何编辑 Joomla 模板标题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19149969/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to edit the Joomla template header?
提问by Fizzix
Basically, I am just trying to slightly modify my Joomla template.
基本上,我只是想稍微修改我的 Joomla 模板。
There is a line of code within the <head>
of my template that is obviously grabbing things such as meta description, meta keywords and title tags.
<head>
我的模板中有一行代码显然是在抓取元描述、元关键字和标题标签等内容。
Here is the code <jdoc:include type="head" />
这是代码 <jdoc:include type="head" />
I would like to know where this code is located since I would like my title tag
above both my meta description
and meta keywords
.
我想知道此代码的位置,因为我希望title tag
我的meta description
和meta keywords
.
Is this possible?
这可能吗?
回答by Jobin Jose
Try this,
尝试这个,
Its not recommended editing core files.
不推荐编辑核心文件。
You can find the meta and title section of the Joomla sites.
您可以找到 Joomla 站点的元和标题部分。
libraries\joomla\document\html\renderer\head.php
contains a function fetchHead()
包含一个函数 fetchHead()
Hope its helped...
希望它有帮助...
回答by BastianW
You could copy the header.php to your template folder (name it head_renderer.php) and inside the index.php from your template reference the new header.php via:
您可以将 header.php 复制到您的模板文件夹(将其命名为 head_renderer.php)并在您的模板中的 index.php 中通过以下方式引用新的 header.php:
require_once dirname(FILE) . DIRECTORY_SEPARATOR . 'head_renderer.php'; // our modifized renderer for the Joomla header
require_once 目录名(文件)。DIRECTORY_SEPARATOR 。'head_renderer.php'; // 我们为 Joomla 标头修改的渲染器
then you do not fully "edit the core files". However its a hack and not a template overwrite. But via this approach you can update joomla and do not need to check if your changed header.php is changed.
那么你就没有完全“编辑核心文件”。然而,它是一个黑客而不是模板覆盖。但是通过这种方法,您可以更新 joomla 并且不需要检查您更改的 header.php 是否已更改。
A better howto can be found here.
可以在此处找到更好的操作方法。