【发布时间】:2023-04-08 21:14:01
【问题描述】:
我想在安装组件时显示一个带有 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 或显示表单,它就无法正常工作和组件安装。我该怎么做?
【问题讨论】:
标签: php joomla installation components joomla3.0