0

嗨,我是模块开发的新手。我需要知道如何将变量从 tmpl/default.php 传递到 mod_.php,因为我无法从我参考的教程中获得它。这就是我使用的方式:

 tmpl/default.php (not the full code)
    <form action="index.php" method="post" id="sc_form">
    <input type="hidden" name="form_send" value="send" />
    <label>Your name:</label><br/>
    <input type="text" name="your_name" value="" size="40" /><br/><br/>

    <label>Your question:</label><br/>
    <textarea name="your_question" rows="5" cols="30"></textarea><br/><br/>

    <input type="submit" name="send" value="Send" />

    </form>

   -----------------------------------------------------------------------------------

mod_modulename.php

   $form_send = JRequest::getVar('form_send', 'notsend');

    switch($form_send){

    case 'send':     
    require(JModuleHelper::getLayoutPath('mod_<module_name>', 'sendok'));
    break;

    default:
    require(JModuleHelper::getLayoutPath('mod_<module_name>', 'default'));

}

非常感谢您的考虑。这对我来说将是一个很大的帮助......

4

1 回答 1

0

JRequest方法在 3 中已弃用。JInput改为使用。前任:

$input = JFactory::getApplication()->input;
$form_send  = $input->get('form_send', 'notsend');

希望能帮助到你

于 2013-08-10T09:29:27.717 回答