joomla module development with form - how to process

好久不见. 提交于 2019-12-04 07:22:12

Yes, you should do form processing in module helper class. Keep any logic out of the template file, and you can use mod_mymodule.php to call helper methods and assign variables before including the view file.

Do not set as form action helper file! I think in your case action should be the same page, so you can also ommit action url.

Edit: As requested in the comments, this would be the content of your mod_mymodule.php

// include helper file
require_once dirname(__FILE__).'/helper.php';
// call some method of the helper class
$items = modMymoduleHelper::getItems();

$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
// render view file from mod_mymodule/tmpl/default.php, $items is available in the view file
require JModuleHelper::getLayoutPath('mod_mymodule', $params->get('layout', 'default'));
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!