![](/img/trans.png)
[英]How pass variable from template index.php to the component in Joomla?
[英]How to get and echo the “Alternative Layout” value from the Joomla! MENU module in index.php (template)?
我需要为我的MENU模块获取“ Alternative Layout”的值:
例:
备用布局= layout1
我需要在模板文件(index.php)中回显值“ layout1”
这可能吗? 提前致谢。
您必须添加到模板中的代码是:
<?php
jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'menu', 'Footer menu' );
$moduleParams = new JRegistry();
$moduleParams->loadString($module->params);
$layout = $moduleParams->get('layout');
echo $layout;
?>
您必须在以下位置设置模块的类型和标题:
getModule('menu','Footer menu');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.