Ale*_*ova 2 php joomla head joomla3.0
我想很好地订购一个joomla网站的头部.在搜索论坛后,我遇到了这个http://forum.joomla.org/viewtopic.php?f=642&t=671526&p=3283757#p3283757
有一个很好的建议是将/renderer/head.php文件复制到模板文件夹中并将其更改为当前需要.
他们建议
Blockquote head.php中的render函数不使用$ name var,因此可以使用js和metatags与css文件分开并使用如下的jdoc语句:
jdoc:include type="head" name="head" <-- will include all exept js (into
the head section)
jdoc:include type="head" name="foot" <-- for the js (before body tag closes)
Run Code Online (Sandbox Code Playgroud)
大段引用
但我根本不知道如何实现这一点.
有人在Joomla编辑head.php吗?我将不胜感激任何帮助.
我对它进行了一些调查,看起来有点hacky.
该解决方案目前正在研究Joomla 3.*.
首先,你必须修改/librabies/joomla/document/document.php.一旦你在那里更新函数loadRenderer()从这:
public function loadRenderer($type)
{
$class = 'JDocumentRenderer' . $type;
if (!class_exists($class))
{
$path = __DIR__ . '/' . $this->_type . '/renderer/' . $type . '.php';
if (file_exists($path))
{
require_once $path;
}
else
{
throw new RuntimeException('Unable to load renderer class', 500);
}
}
if (!class_exists($class))
{
return null;
}
$instance = new $class($this);
return $instance;
}
Run Code Online (Sandbox Code Playgroud)
对此:
public function loadRenderer($type)
{
$class = 'JDocumentRenderer' . $type;
if (!class_exists($class))
{
$path = __DIR__ . '/' . $this->_type . '/renderer/' . $type . '.php';
$app = JFactory::getApplication('site');
$path_custom = JPATH_THEMES . '/' . $app->getTemplate() .'/html/renderer/' . $type . '.php';
if (file_exists($path_custom))
{
require_once $path_custom;
}
elseif (file_exists($path))
{
require_once $path;
}
else
{
throw new RuntimeException('Unable to load renderer class', 500);
}
}
if (!class_exists($class))
{
return null;
}
$instance = new $class($this);
return $instance;
}
Run Code Online (Sandbox Code Playgroud)
实际上,新代码正在模板目录中查找渲染文件.
现在你允许复制libraries/joomla/document/html/renderer/head.php到templates/TEMPLATE_NAME/html/renderer/head.php并对其进行修改.
如果你想使用那些:
<jdoc:include type="head" name="head" />
<jdoc:include type="head" name="foot" />
Run Code Online (Sandbox Code Playgroud)
点击此处更新templates/TEMPLATE_NAME/html/renderer/head.php到此版本.
| 归档时间: |
|
| 查看次数: |
9900 次 |
| 最近记录: |