如何在joomla的页眉和页脚中加载菜单模块?

时间:2017-06-01 12:39:19

标签: joomla joomla3.0 joomla-extensions joomla-template joomla-module

我在我的模板中添加了joomla的Menu模块。但我需要它同时加载页脚位置。因此,如果我添加另一个菜单,它应该被添加到页眉和页脚中的位置...我想要做的是将菜单模块加载到页面中,页眉和页脚中的两个不同位置。 / p>

我曾尝试在菜单模块的管理员部分添加多个职位......

屏幕截图如下

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

如果我理解正确,您应该只需复制菜单模块(在extensions->模块中),并将复制模块添加到模板页脚中的模块位置。如果页脚中没有模块位置,则将其添加到templateDetails.xml中的 - 列表中,并将其添加到模板中的index.php,如:

<jdoc:include type="modules" name="footer-menu" style="xhtml" />

答案 1 :(得分:1)

最新版本。 Joomla3.x: 按模板位置获取所有模块(用模板位置替换位置):

<?php
$modules  = JModuleHelper::getModules("position");
$document = JFactory::getDocument();     
$attribs  = array();
$attribs['style'] = 'xhtml';
foreach ($modules as $mod) {
  echo JModuleHelper::renderModule($mod, $attribs);
}
?>

其他解决方案:您可以在模板中定义位置并将模块分配到该位置

步骤: 1.自定义templateDetails.xml文件 加 在newPosition

2.在模板的索引文件中创建位置 在templates / your_template / index.php

<jdoc:include type="modules" name="newposition"   />