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

时间:2016-04-04 08:40:27

标签: php joomla install components joomla3.0

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

见图片,我希望它是这样的: enter image description here

1 个答案:

答案 0 :(得分:1)

我认为下面的joomla笔记对你有帮助

This is the entire script.php file