2012-02-08 51 views
0

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; 
    } 
} 

注:それはちょうどそれが有効になっていて、インストールされているにもかかわらず、すべての(エラーなし、ノーコードの実行)で実行する必要はありません。

ご協力いただければ幸いです。

+1

を読むことができますルート) – Nobody

+0

比較的に 'components/com_registeredtags/helloworld.php' –

+1

私はしばらくjoomlaで動作しませんでしたが、コンポーネントファイルの名前に命名規則があることを覚えています。私はそれが 'componentname.php'であるべきだと思います。だから、 'helloworld.php'ではなく' registeredtags.php'になります。 – Nobody

答えて

1

Joomla!のプラグインイン!サイトルートを基準にしてplugins/plugin-type/plugin_name/に格納されます。コンポーネントはcomponents/ディレクトリに格納されます。

例えば、改ページのコンテンツプラグインは、「プラグイン/コンテンツ/改ページ/」で発見され、ファイルが含まれています

plugins/content/pagebreak/pagebreak.php 
plugins/content/pagebreak/pagebreak.xml 
plugins/content/pagebreak/index.html   // not an active file 

あなたは、ファイル名と場所、それはJoomlaのに比べて(配置されているどの程度creating a content plugin here.

+0

私はこれを試してみましょう!ありがとう! –

+0

すごく感謝しました! –

関連する問題