【问题标题】:set status as publish while installing component in Joomla在 Joomla 中安装组件时将状态设置为发布
【发布时间】:2014-12-22 06:54:42
【问题描述】:

安装时可以发布模块吗?

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

我在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>

请给点建议。

【问题讨论】:

  • 为什么要自动发布模块。即使模块发布了,你也必须浪费你的精力来给那个位置出现在网页上,并且可能设置一些参数

标签: php joomla joomla-extensions


【解决方案1】:

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

  1. 如果您越权,请慎重考虑。您是否 100% 确定安装组件/模块的所有用户将想要立即发布该模块?
  2. 您会将模块发布到哪个模块位置?无法保证使用的模板使用了任何特定的模块位置

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-21
    • 1970-01-01
    • 1970-01-01
    • 2021-11-05
    相关资源
    最近更新 更多