更改PHP代码Joomla插件

时间:2011-07-27 09:50:55

标签: php plugins joomla

如何更改代码以便文本“我是一个快乐的插件”仅出现在已归档的项目中?。

这是PHP代码:

<?php
// No direct access allowed to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

// Import Joomla! Plugin library file
jimport('joomla.plugin.plugin');

//The Content plugin MakePlugIn
class plgContentMakePlugIn extends JPlugin
{
    function plgContentMakePlugIn (&$subject)
    {
        parent::__construct ($subject);
    }
    function onPrepareContent (&$article, &$params, $page=0)
    {
        print "I am a happy plugin";
    }
}
?>

1 个答案:

答案 0 :(得分:1)

看起来这就是你要找的东西:

function onPrepareContent (&$article, &$params, $page=0)
{
    if ($article->state==-1) {
        print "I am a happy plugin";
    }
}