在Joomla中安装组件时,将状态设置为发布


set status as publish while installing component in Joomla

是否可以在安装时发布模块?

我正在随组件一起安装一个模块。安装组件时,我需要将模块的状态设置为发布。

我在manifest.xml文件中使用以下代码:

<modules>
    <module module="mod_custom" publish="true"/>
    // I also tried none of them work
    <module module="mod_custom" client="administrator" publish="true" />
</modules>

有什么建议吗。

在组件的install.php中,您可以在#__extensions表中查找已安装模块的id,然后将其添加到模块表中并发布,但是。。。

  1. 如果你超越了自己的责任,请仔细考虑。您是否100%确定所有安装组件/模块的用户都希望立即发布模块
  2. 您将模块发布到哪个模块位置?不能保证使用的模板使用任何特定的模块位置

您可以在此处了解有关installphp文件的更多信息:http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Adding_an_install-uninstall-update_script_file