长话短说:我尝试为Joomla复制一个Hello World插件,该插件旨在将"Hello World"放在每篇文章中,它安装正确,但根本不起作用。
你好世界.php:
<?php
// no direct access
defined('_JEXEC') or die;
class plgContentHelloworld extends JPlugin
{
public function onContentAfterTitle($context, &$article, &$params, $limitstart)
{
return "<p>Hello World!</p>";
}
}
?>
你好世界.xml:
<?xml version="1.0" encoding="utf-8"?>
<extension version="2.5" type="plugin" group="content">
<name>plg_content_helloworld</name>
<author>Brad Markle</author>
<creationDate>June 18th, 2012</creationDate>
<copyright>InMotion Hosting</copyright>
<license>GNU General Public License</license>
<authorEmail>bradm@inmotionhosting.com</authorEmail>
<authorUrl>http://www.inmotionhosting.com</authorUrl>
<version>1.0</version>
<description>Simple Hello World Plugin that prints "Hello World" at the beginning of every article.</description>
<files>
<filename plugin="helloworld">helloworld.php</filename>
<filename>index.html</filename>
</files>
</extension>
我已经确保我启用了该插件并禁用了所有文章的"显示介绍文本"。
检查这个。一个内容插件,将所有"A"替换为"a"。这应该对你有很大帮助(就像过去的我一样)。