我有这样的文件:
mod_get_price.php:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
require_once('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'));
}
?>
助手.php:
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class ModLittleContactHelper{
public function SendMail($your_name, $your_question){
$config = JFactory::getConfig();
$mail = JFactory::getMailer();
$sender = array($config->get( 'config.mailfrom' ), $config->get( 'config.fromname' ));
$mail->setSender($sender);
$mail->setSubject('Сообщение с сайта');
$mail->addRecipient('info@dmgroup.su');
$body = "Вопрос с сайта<br/>";
$body.= "-------------------------<br/>";
$body.= "Пользователь: ".$your_name."<br/>";
$body.= "Вопрос: ".$your_question."<br/>";
$mail->setBody($body);
$mail->IsHTML(true);
$send = $mail->Send();
return $send;
}
}
?>
和两个模板:default_tmpl 和 sendok_tmpl
default_tmpl :
<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>
<div class="right_area">
<h3>ЗАДАТЬ ВОПРОС</h1>
<form action="index.php" method="post" id="sc_form">
<input name="your_question" rows="5" cols="30" placeholder="Ваш вопрос" required></input><br/>
<input name="your_name" rows="5" cols="30" placeholder="Ваш e-mail" type="email" required/><br/>
<input type="submit" name="send" value="Отправить" id="send-button" />
</form>
</div>
当我点击发送按钮时 - 没有任何反应,邮箱也是空的。
我做错了什么,以及如何编写简单的反馈模块插件?
我使用 3.1 joomla
模块:https ://dl.dropboxusercontent.com/u/59666091/mod_get_price.zip
邮件设置一切正常