【问题标题】:Third party plugin not override in joomla第三方插件不会在 joomla 中覆盖
【发布时间】:2016-07-08 12:36:27
【问题描述】:

我在 joomla 中创建了一个搜索插件,即“my-plug-in”。当我尝试在 joomla 模板中覆盖此插件时,它不起作用。如果我尝试覆盖任何现有的插件 joomla 其工作。我也检查了下面的链接。这是有效的

This link

我如何在 joomla 模板中覆盖我的插件。

我已经在下面的地方添加了我的插件。

plugins/search/my-plug-in

to 

templates/{TEMPLATENAME}/html/plg_search_my-plug-in

【问题讨论】:

    标签: plugins joomla overriding joomla3.0


    【解决方案1】:

    如果您彻底检查了您提供的链接,您会发现一行“但是,只有当插件准备好允许覆盖时,您才能这样做。

    Joomla 提供了一种覆盖插件的机制,但并非所有插件都支持此功能。目前,Joomla 3.x 核心中唯一允许覆盖的插件是 Pagenavigation Content 插件,它在内容组件的文章视图中显示上一篇/下一篇文章链接。可能有来自第三方开发者的其他插件允许它,并且将来会覆盖更多的核心插件。

    您的插件中是否有一个 tmpl 文件夹,如此处引用的那样“您会知道什么时候插件是可覆盖的,因为其中有一个 /tmpl/ 文件夹。

    你也用过JPluginHelper::getLayoutPath()。这些是在覆盖布局之前需要完成的要求。 在页面导航插件中检查此代码

    // Output.
                if ($row->prev || $row->next)
                {
                    // Get the path for the layout file
                    $path = JPluginHelper::getLayoutPath('content', 'pagenavigation');
                    // Render the pagenav
                    ob_start();
                    include $path;
                    $row->pagination = ob_get_clean();
                    $row->paginationposition = $this->params->get('position', 1);
                    // This will default to the 1.5 and 1.6-1.7 behavior.
                    $row->paginationrelative = $this->params->get('relative', 0);
                }
    

    他们使用了 JPluginHelper::getLayoutPath();你必须使用

    $path = JPluginHelper::getLayoutPath('search', 'my-plug-in');
    

    您可以彻底检查页面导航插件以获得一个好主意。

    【讨论】:

      猜你喜欢
      • 2017-05-10
      • 2015-08-27
      • 2017-01-26
      • 1970-01-01
      • 1970-01-01
      • 2018-04-06
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多