【问题标题】:Simple Joomla 3 plugin doesn't display简单的 Joomla 3 插件不显示
【发布时间】:2016-08-11 04:55:13
【问题描述】:

我创建了一个简单的测试插件来在文章之前显示一些文本,但它在文章文本之前不显示任何内容。

<?php

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

class plgContentArticlePhoto extends JPlugin
{
    protected $autoloadLanguage = true;

    function onContentPrepare($context, &$article, &$params, $limitstart)
    {                
        $test = 'test plugin ';
        $article->text = $test . $article->text;                        
        return true;
    }  
}


?>

xml文件:

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.2" type="plugin" group="content" method="upgrade">
    <name>Article Photo</name>
    <author>JV</author>
    <creationDate>August 2016</creationDate>
    <copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
    <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
    <authorEmail></authorEmail>
    <authorUrl></authorUrl>
    <version>1.0</version>
    <description>Article Photo</description>
    <files>
        <filename plugin="article_photo">article_photo.php</filename>
        <filename>index.html</filename>
    </files>
    <config>

    </config>
</extension>

有人可以帮忙吗? 谢谢

【问题讨论】:

  • 你能显示你的xml文件吗?

标签: plugins joomla


【解决方案1】:

确保您的插件已发布? 如何发布你的插件 管理员 > 插件管理器 > 你的插件名称 > 已发布。

试试这个..

            <?php
            /**
             * @copyright   Copyright (c) 2016 Article Photo. All rights reserved.
             * @license     http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
             */

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

            jimport('joomla.plugin.plugin');

            /**
             * content - ArticlePhoto Plugin
             *
             * @package     Joomla.Plugin
             * @subpakage   ArticlePhoto.ArticlePhoto
             */
            class plgcontentArticlePhoto extends JPlugin {

                /**
                 * Constructor.
                 *
                 * @param   $subject
                 * @param   array $config
                 */
                public function onContentPrepare($context, &$article, &$params, $page = 0)
                {
                    $test = 'test plugin';
                    $article->text = $test . $article->text;                        
                    return true;

                }

            }

我希望它的作品

【讨论】:

  • 嗨,它不起作用。会不会是 joomla 设置不让它出现?
  • 你运行这个插件的 url 是什么?您确定插件已发布并且 URL 是文章或博客页面,例如:非 sef url:index.php?option=com_content&view=article&id={your article id} OR index.php?option=com_content&view=category&layout=blog?
猜你喜欢
  • 2017-05-28
  • 2013-05-11
  • 2013-02-26
  • 2013-09-01
  • 1970-01-01
  • 2013-05-03
  • 2013-03-13
  • 2014-08-21
  • 1970-01-01
相关资源
最近更新 更多