joomla组件中调用插件

发布于 2024-11-02 17:50:10 字数 66 浏览 0 评论 0原文

我如何在任何 joomla 组件中调用 joomla '简单图片幻灯片'插件。有什么解决办法吗?

谢谢

How can i call joomla 'Simple Picture Slideshow' plugin in any joomla component. Have any solution?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不…忘初心 2024-11-09 17:50:10

在 Joomla 中调用内容插件的最佳方式! 1.5及以上版本只需使用:

$text = JHTML::_('content.prepare', $text);

http://docs.joomla.org/Triggering_content_plugins_in_your_extension

Best way to call content plugins in Joomla! 1.5 and above is just use:

$text = JHTML::_('content.prepare', $text);

http://docs.joomla.org/Triggering_content_plugins_in_your_extension

爱情眠于流年 2024-11-09 17:50:10

您可以调用该插件中定义的插件的任何事件。

$dispatcher = JDispatcher::getInstance();
$data = array($argu1, $argu2);   // any number of arguments you want
return $dispatcher->trigger($eventName, $data);

You can call any event of plugin which is defined in that plugin.

$dispatcher = JDispatcher::getInstance();
$data = array($argu1, $argu2);   // any number of arguments you want
return $dispatcher->trigger($eventName, $data);
一杯敬自由 2024-11-09 17:50:10

在 Joomla 中,插件不是典型意义上的调用,它们是由各种事件触发的。该插件侦听触发它的特定事件。在这种情况下,您需要查看简单图片幻灯片监听的内容,然后将该触发器添加到您的组件中。保证插件始终被触发的唯一方法是让它监听全局系统事件之一,无论组件中的代码如何,这些事件都会发生,它们发生在框架级别。如果插件是由非全局事件触发的,那么您需要更改插件或将事件添加到您想要使用该插件的每个组件。

全局系统事件参考 - http://docs.joomla.org/Reference:System_Events_for_Plugin_System

插件参考 - http://docs.joomla.org/Plugin

In Joomla, plugins are not called in the typical sense, they are triggered by various events. The plugin listens for the particular event that triggers it. In this case, you would need to look and see what even Simple Picture Slideshow listens for, then add that trigger to your component. The only way to guarantee that a plugin will be triggered all the time is have it listen for one of the global system events, these happen regardless of the code in the component, they happen at the framework level. If a plugin is triggered by a non-global event, then you would need to either change the plugin or add the event to every component you want using the plugin.

Global system event reference - http://docs.joomla.org/Reference:System_Events_for_Plugin_System

Plugin reference - http://docs.joomla.org/Plugin

蓝颜夕 2024-11-09 17:50:10

这个问题专门针对joomla的Content插件。

您可以触发组件中的任何插件事件。

下面是触发 content 插件 onPrepareContent 事件的示例。

$content = new stdClass;
$content->text = 'Your content body with proper tag or 
                    content wich you want to replace. 
                    For example:  {loadmodule mod_login}';
$atricle = array();

JPluginHelper::importPlugin('content');
$dispatcher = JDispatcher::getInstance();

JDispatcher::getInstance()->trigger(
    'onPrepareContent',
    array(
        &$content,
        &$atricle,
        null
    )
);

或者,如果您只想触发组件的特定插件,那么您可以使用,

JPluginHelper::importPlugin('content', 'loadmodule');

第二个参数是您要使用的插件的名称。

同样,您可以在组件中调用用户插件事件。

JPluginHelper::importPlugin('user', 'contactcreator');

JDispatcher::getInstance()->trigger(
    'onUserAfterSave', 
    array(
        $user, 
        $isnew, 
        $success, 
        $msg
    )
);

This question is specifically for Content plugin of joomla.

You can trigger any plugin event in your component.

Here is an example to trigger content plugin onPrepareContent event.

$content = new stdClass;
$content->text = 'Your content body with proper tag or 
                    content wich you want to replace. 
                    For example:  {loadmodule mod_login}';
$atricle = array();

JPluginHelper::importPlugin('content');
$dispatcher = JDispatcher::getInstance();

JDispatcher::getInstance()->trigger(
    'onPrepareContent',
    array(
        &$content,
        &$atricle,
        null
    )
);

Or if you want to trigger only specific plugin for your component, then you can use,

JPluginHelper::importPlugin('content', 'loadmodule');

Second argument is name of the plugin which you want to use.

Similarly, you can call user plugin event in your component.

JPluginHelper::importPlugin('user', 'contactcreator');

JDispatcher::getInstance()->trigger(
    'onUserAfterSave', 
    array(
        $user, 
        $isnew, 
        $success, 
        $msg
    )
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文