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

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

问题描述:

I want to show a small form with JavaScript when I install component like when we install our component then after installation I just want to show a form. I have created a file that is script.commercial.php and add this file in component xml see below my code:

commercial.xml file

<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');

But its not working and component install without showing this Click here or show form. How can I do this?

See Image, I want it to be like that: enter image description here

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

commercial.xml文件 p>

 &lt; scriptfile&gt; script.commercial.php&lt; / scriptfile&gt; 
&lt; installfile&gt; script.commercial.php&lt; / installfile&gt; 
  code>   pre> 
 
 

script.commercial.php strong> p>

 &lt;?php 
defined('_ JEXEC')or die  ('限制访问'); 
defined('DS')或define('DS',DIRECTORY_SEPARATOR); 
 
函数install(){
 $ this-&gt; cmInstall(); 
} 
 
 
函数 cmInstall()
 {
 echo'Exal Form here。'; 
 echo'&lt; span class =“installScript”id =“installScript”&gt; 点击这里..!!  &lt; / span&gt;'; 
} 
 
 $ document = JFactory :: getDocument(); 
 $ document-&gt; addScript(JURI :: BASE()。'components / com_commercial / commercial.js')  ; 
  code>  pre> 
 
 

但如果没有在此处显示此单击 code>或显示表单,则无法正常工作和组件安装。 我该怎么做? p>

见图片,我希望它是这样的: p> DIV>

I think below the joomla notes helpful for you

This is the entire script.php file