【问题标题】:Install Hook on Joomla module在 Joomla 模块上安装 Hook
【发布时间】:2012-10-25 15:10:45
【问题描述】:
我试图在安装 Joomla 模块时运行安装钩子,我的模块中有这个,但它不起作用!我需要调用这个类所在的文件吗?
class mod_impalawifiInstallerScript
{
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
我看过文档。
【问题讨论】:
标签:
php
joomla
installation
joomla-extensions
【解决方案1】:
我找到了,你需要把它放在你的xml文件中。
<scriptfile>script.php</scriptfile>
【解决方案2】:
在 Joomla 1.6+ 中,您有两种选择。
第一,您可以在 .zip 文件的根目录中包含一个名为 install.*componentname*.php 的文件。该文件应包含一个函数com_install。在安装组件期间将调用此函数。 (更多信息here)
另一个选项是使用<scriptfile> 标记定义要在您的XML 中运行的脚本。这应该放在元数据之后,但在文件位置之前(与 SQL 等其他安装内容一起)。文档和示例here.