在 joomla 中安装组件时显示表单

Show form when install component in joomla

我想在安装组件时显示一个 JavaScript 的小表格,就像我们安装组件时一样,然后在安装后我只想显示一个表格。我创建了一个 script.commercial.php 文件,并将此文件添加到组件 xml 中,请参阅下面的代码:

commercial.xml 文件

<scriptfile>script.commercial.php</scriptfile>
<installfile>script.commercial.php</installfile>

script.commercial.php

    <?php
defined ('_JEXEC') or die('Restricted access');
defined ('DS') or define('DS', DIRECTORY_SEPARATOR);

function install () {
    $this->cmInstall();
}

function cmInstall()
{
    echo 'Show Form here.';
    echo '<span class="installScript" id="installScript"> Click Here..!! </span>';
}

$document = JFactory::getDocument();
$document->addScript(JURI::BASE().'components/com_commercial/commercial.js');

但是它无法正常工作,并且组件安装没有在此处显示此 Click 或显示表格。我该怎么做?

看图,我希望它是这样的:

我认为下面的 joomla 注释对您有帮助

This is the entire script.php file