现在我有这样的文件夹和文件结构:
我的mod_get_price.xml:
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_helloworld</name>
<author>Brad Markle</author>
<creationDate>June 18th, 2012</creationDate>
<copyright>InMotion Hosting</copyright>
<license>GNU General Public License</license>
<authorEmail>bradm@inmotionhosting.com</authorEmail>
<authorUrl>http://www.inmotionhosting.com</authorUrl>
<version>1.0</version>
<description>Simple Hello World Plugin that prints "Hello World" at the beginning of every article.</description>
<files>
<filename>mod_get_price.xml</filename>
<filename module="mod_get_price">mod_get_price.php</filename>
<filename>index.html</filename>
<filename>css/style.css</filename>
<filename>tmpl/default_tmpl.php</filename>
<filename>tmpl/sendok_tmpl.php</filename>
<filename>helper.php</filename>
</files>
</extension>
我的mod_get_price.php:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
require_once(dirname(__FILE__).DS.'helper.php');
JHTML::stylesheet('styles.css','modules/mod_get_price/css/');
$form_send = JRequest::getVar('form_send', 'notsend');
switch($form_send){
case 'send':
$your_name = JRequest::getVar('your_name', 'No name');
$your_question = JRequest::getVar('your_question', 'No question');
$send = ModLittleContactHelper::SendMail($your_name,
$your_question);
if ( $send !== true ) {
echo 'Error sending email: ' . $send->message;
}
require(JModuleHelper::getLayoutPath('mod_get_price', 'sendok_tmpl'));
break;
default:
require(JModuleHelper::getLayoutPath('mod_get_price', 'default_tmpl'));
}
?>
my helper.php:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class ModLittleContactHelper{
public function SendMail($your_name, $your_question){
$mail =& JFactory::getMailer();
$mail->setSender('josemanises@gmail.com', 'Wayofthewebninja');
$mail->setSubject('Contact from our site');
$mail->addRecipient('josemanises@gmail.com');
$body = "Contact form send by user<br/>";
$body.= "-------------------------<br/>";
$body.= "Username: ".$your_name."<br/>";
$body.= "Question: ".$your_question."<br/>";
$mail->setBody($body);
$mail->IsHTML(true);
$send =& $mail->Send();
return $send;
}
}
?>
my tmpl / default_tmpl.php:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<div id="littlecontact">
<h1>Just a simple contact form!</h1>
<form action="index.php" method="post" id="sc_form">
<label>Your name:</label><br/>
<input type="text" name="your_name" value="" size="40"
class="sc_input"/><br/><br/>
<label>Your question:</label><br/>
<textarea name="your_question" class="sc_input" rows="5"
cols="30"></textarea><br/><br/>
<input type="submit" name="send" value="Send"
class="sc_button" />
</form>
</div>
但!当我尝试安装这个简单的插件时,我得到一些想法:插件没有安装。发生了错误。插件文件未指定。
为什么呢?如何安装我的插件,我做错了什么?
我也使用joomla 3.1
答案 0 :(得分:1)
问题是,您正在尝试将Joomla模块安装为插件。只需在XML文件中替换此行:
<extension version="3.1" type="plugin" group="content">
使用:
<extension type="module" version="3.1" client="site" method="upgrade">