0

现在我有这样的文件夹和文件结构:

在此处输入图像描述

我的 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'));
}

?>

我的 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;
  }
}
?>

我的 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

4

1 回答 1

1

问题是,您正在尝试将 Joomla 模块安装为插件。只需在您的 XML 文件中替换这一行:

<extension version="3.1" type="plugin" group="content">

和:

<extension type="module" version="3.1" client="site" method="upgrade">
于 2013-11-12T05:31:51.057 回答