Plugins Joomla 1.7:从系统插件更改元标记
Joomla版本1.7 在管理部分中启用插件 插件代码:Plugins Joomla 1.7:从系统插件更改元标记,plugins,joomla,Plugins,Joomla,Joomla版本1.7 在管理部分中启用插件 插件代码: <?php // no direct access defined('_JEXEC') or die; jimport('joomla.plugin.plugin'); class plgSystemMetatags extends JPlugin { public function __construct(&$subject, $config) { parent::__constr
<?php
// no direct access
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class plgSystemMetatags extends JPlugin
{
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
}
public function onBeforeRender()
{
$document =& JFactory::getDocument();
$document->setMetaData('keywords', 'test keywords');
}
}
使用onBeforeRender
而不是onAfterRender
当事件被触发时,应用程序的输出已经在响应缓冲区中可用。谢谢,但我刚刚发现,Joomla甚至没有执行我的插件。它在系统中已启用。但仍然需要使用onBeforeRenderI将事件更改为onBeforeRender-无,即使我在该文件中输入了错误的构造-没有任何错误。它根本不执行。请启用调试模式,并在全局配置中将错误报告设置为最大值。如果有任何警告或错误,请告诉我。什么都没有!标准配置文件信息、内存使用和查询列表
<?xml version="1.0" encoding="utf-8"?>
<extension version="1.7" type="plugin" group="system" method="upgrade" client="site">
<name>System - Metatags</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2011 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>1.7.0</version>
<description></description>
<files>
<filename plugin="metatags">metatags.php</filename>
<filename>index.html</filename>
</files>
</extension>