如何获得自定义的Joomla菜单以及子菜单

时间:2018-07-24 04:37:13

标签: joomla menu joomla3.0 submenu joomla-module

我想在Joomla菜单中添加架构...!下面是代码

<?php
        $menu = JFactory::getApplication()->getMenu();
        // Get menu items - array with menu items
        $items = $menu->getItems('menutype', 'mainmenu');
        //print_r($items);
        ?>
        <ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
            <?php foreach($items as $i => $menu_item){

                ?>
                <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/"><?php if($menu_item->level == '1') { echo $menu_item->title; } ?></a>
                    <?php if($menu_item->level == '2') {?>
                    <ul>
                        <li><?php echo $menu_item->title; ?></li>
                    </ul><?php } ?>
                </li>
            <?php } ?>
        </ul>

我面临的问题是,上面没有打印子菜单,我找不到任何解决方法

例如:

<ul itemscope itemtype="http://www.schema.org/SiteNavigationElement">
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Home</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">About</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Publications</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">FinTech: Now Everybody Wants A Slice of the Pie</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">The Role of Financial Centres in Emerging Economies</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Bitcoin versus Ethereum </a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">ADGM</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">DIFC</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Finance</a>
                </li>
                            <li itemprop="name"><a itemprop="url" href="http://www.10leaves.ae/">Contact</a>
                </li>
                    </ul>

发布菜单包含子菜单(FinTech)和另外两个。我不知道如何在子菜单中打印它们

1 个答案:

答案 0 :(得分:1)

您能不能尝试塔索斯马里诺斯(Tassos Marinos)的Extension

戴夫