The*_*fNL 3 joomla templates module joomla1.5
我正在尝试创建自己的模块,我按照以下教程:LINK
在文件"/modules/mod_hello_world2/mod_hello_world2.php"中存在以下代码.
// get the items to display from the helper
$items = ModHelloWorld2Helper::getItems($userCount);
// include the template for display
require(JModuleHelper::getLayoutPath('mod_hello_world2'));
Run Code Online (Sandbox Code Playgroud)
此代码显示'/modules/mod_hello_world2/tmpl/default.php'的内容,其中包含$ items解析的数据.
现在我想知道是否以及如何调用不同的模板文件.我想为表单创建一个,为结果创建另一个.由于最好将代码和HTML分开,我希望这样做.
非常欢迎任何帮助!
JModuleHelper :: getLayoutPath有一个可选的布局参数.
http://api.joomla.org/Joomla-Framework/Application/JModuleHelper.html#getLayoutPath
所以......
require(JModuleHelper::getLayoutPath('mod_hello_world2', 'mylayout'));
Run Code Online (Sandbox Code Playgroud)