0

これは私のプラグインです:

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Import library dependencies
jimport('joomla.plugin.plugin');

class plgContentEya extends JPlugin
{

 function plgContentEya( &$subject, $config )
 {
    parent::__construct( $subject, $config );

 }
/**
 * Plugin method with the same name as the event will be called automatically.
 */
 function onAfterDisplayContent( &$article, &$params, $limitstart)
 {//Echo script there
echo "script works";
        // Plugin code goes here.
        // You can access parameters via $this->params.
    return "<script src='http://widget.eya.com/sprk.1.0.2.js' type='text/javascript'></script>";
 }
}




http://docs.joomla.org/Plugin/Events/Content

彼らの文書によると

  Return Value
String. Returned value from this event will be displayed in a placeholder. Most templates display this placeholder after the article separator.

プラグインが表示され、インストールしてもエラーは発生しません。ただし、イベントがトリガーされることはありません。私はそれを文書に見ていません

<install version="2.5" type="plugin" group="content">
   <name>plg_content_eya</name>
   <author>eya</author>
   <creationDate>February 2013</creationDate>
   <copyright>(C) 2013 Open Source Matters. All rights reserved.</copyright>
   <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
   <authorEmail>anattaligg@graeit.com</authorEmail>
   <authorUrl>www.eya.com</authorUrl>
   <version>2.5.0</version>
   <description>Adds eya plugin ot your site</description>
   <files>
     <filename plugin="eya">eya.php</filename>
   </files>

</install>
4

1 に答える 1

2

XML に基づくと、version="2.5"イベント名が間違っているため、プラグインが呼び出されていません。

Plugin/Events/Content for Joomla!からイベント名が変更されました。1.5ドキュメントが作成されました。それを明確にするために、1.5 ドキュメントとしてマークしました。

イベントはより一貫性のある名前に変更されました (ドメイン/期間/イベント、例: Content/After/Display )。そのため、必要なイベントが呼び出されるようになりonContentAfterSaveました。名前が変更されたイベントの詳細については、記事「Adapting a Joomla 1.5 extension to Joomla 」を参照してください。 1.6 "

Joomla! をサポートしたい場合 プラグインの 1.5 も同様に、2.5 呼び出しをキャッチしてメソッドにリダイレクトするために互換性レイヤーを追加する必要があります。例えば

// Catch 2.5
public function onContentAfterDisplay($article, $params, $limitstart)
{
    $result = $this->onAfterDisplayContent($article, $params, $limitstart);
    return $result;
}

NBテストされていないコードが入力されました...

于 2013-02-10T22:41:50.110 に答える