我想在安装组件时使用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
或显示表单,则无法正常工作和组件安装。我怎么能这样做?