【发布时间】:2016-11-09 07:26:41
【问题描述】:
设置我的自定义插件以在 joomla 中加载最终插件是否有技巧?
我想在安装时而不是之后设置顺序。
是否有像 order="xxx" 这样的自定义参数在 xml 中设置?
【问题讨论】:
标签: joomla
设置我的自定义插件以在 joomla 中加载最终插件是否有技巧?
我想在安装时而不是之后设置顺序。
是否有像 order="xxx" 这样的自定义参数在 xml 中设置?
【问题讨论】:
标签: joomla
我刚刚通过添加xml文件找到了答案
<scriptfile>script.php</scriptfile>
在脚本文件中
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Script file of yourplugin component.
*/
class plgSystemyourplginInstallerScript
{
/**
* method to run after an install/update/uninstall method.
*/
public function postflight($type, $parent)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('ordering').' = '.(int) 999,
);
$conditions = array(
$db->quoteName('element').' = '.$db->quote('wraprotect'),
$db->quoteName('type').' = '.$db->quote('plugin'),
);
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
}
}
不要忘记编辑您的插件名称
在 joomla 1.5 中编辑 #__extensions 到 #__plugins
并删除$db->quoteName('type').' = '.$db->quote('plugin')这一行
【讨论】: