我写了一个Joomla插件!我说“书面”是因为它实际上是其他人的,但它是用于Joomla 1.5,我试图升级它以运行在Joomla 1.7中。但是,它已安装并且不想运行。我试图让它从无到有产生错误,但它不会给我任何东西。 我甚至不确定它是否是Joomla 1.7代码,但我希望你也可以帮忙。Joomla插件没有运行(安装)
<?php
// no direct access
defined('_VALID_MOS') or die('Restricted access');
jimport('joomla.plugin.plugin');
class plgContentRegisteredTags extends JPlugin
{
function plgContentRegisteredTags (&$subject, $params)
{
parent::__construct($subject,$params);
}
function onPrepareContent ($context, &$article, &$params, $page=0)
{
global $mainframe;
//if (!$published) return true;
// define the regular expression for the bot
$regex1 = "#{reg}(.*?){/reg}#s";
$regex2 = "#{noreg}(.*?){/noreg}#s";
// perform the replacement
$article->text = preg_replace_callback(
$regex1,
create_function(
'$matches',
'global $my;
if($my->id) return $matches[1];
return "";'
),
$article->text
);
$article->text = preg_replace_callback(
$regex2,
create_function(
'$matches',
'global $my;
if(!$my->id) return $matches[1];
return "";'
),
$article->text
);
return true;
}
}
注:它只是不希望在所有运行(没有错误,不执行代码),即使它被启用和安装。
任何帮助,将不胜感激。
什么是文件名和位于何处(相对于的Joomla根)安装后? – Nobody 2012-02-08 16:24:34
相对来说,它是'components/com_registeredtags/helloworld.php' – 2012-02-08 16:25:56
我一段时间都没有和joomla一起工作,但我记得组件文件的名称有一些命名约定。我认为它应该是'componentname.php'。所以它将是'registeredtags.php'而不是'helloworld.php'。 – Nobody 2012-02-08 16:32:01