简体   繁体   English

如何从Joomla中获取和回显“替代布局”值! index.php中的MENU模块(模板)?

[英]How to get and echo the “Alternative Layout” value from the Joomla! MENU module in index.php (template)?

I need to get the value of the "Alternative Layout" for my MENU module: 我需要为我的MENU模块获取“ Alternative Layout”的值:

Example: 例:

Alternative Layout = layout1 备用布局= layout1

I need the value "layout1" to be echoed inside my template file (index.php) 我需要在模板文件(index.php)中回显值“ layout1”

is this possible? 这可能吗? Thanks in advance. 提前致谢。

The code that you have to add to your template is: 您必须添加到模板中的代码是:

<?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;
?>

You have to set the type of the module and the title at: 您必须在以下位置设置模块的类型和标题:

getModule( 'menu', 'Footer menu' ); getModule('menu','Footer menu');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM