我寫了一個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