-
Menu - Sub Menu
Hi,
I set up my navigation menu, using the built in navigation menu module.
How can I remove the link from certain navigation menus?
Example:
Webshop
Products
Rainforest Herbs
Rainforest Herbs
Rainforest Herbal Blends
Herbs
Medicinal Herbs
Remedies & Spices
I would like to remove the link from the level 3 menu items ('Rainforest Herbs', 'Herbs'), so the user just clicks on that item and it`s submenus will appear.
I`m using contao 2.9.3.
-
If you edit the page, there must be an option: "Hide for Navigation"
If you are creating the Navigation Module: Can you choose the start and stop Level? So you are able to not show the level three if not needed.
-
But I don`t want to hide it from navigation
Maybe I was not clear.
These are the levels:
Level 1: Webshop
- Level 2: Products
- - Level 3: Rainforest Herbs
- - - Level 4: Rainforest Herbs, single
- - - Level 4: Rainforest Herbal Blends
- - Level 3: Herbs
- - - Level 4: Medicinal Herbs
- - - Level 4: Remedies & Spices
I want to show all the navigation levels, but I want to remove the link from the level 3 navigation, meaning you can see the name of that group (e.a.: Rainforest Herbs or Herbs) but you can`t click on it.
-
Sorry so I don't get it correctly...
Hm. I think you can manage this in the Template. I have no 2.9 installation. This is an example from 2.11 (But I think it could be similar)
Create a new Navigation Template based on "nav_default". Save it as what you want (starting with nav_) and edit it.
Insert the code beneeth -> make sure that it works or is the same structure as in the original template.
Go to you Navigation Module and select this template.
PHP Code:
<?php if($this->level != "level_3"): ?>
<ul class="<?php echo $this->level; ?>">
<?php endif; ?>
<?php foreach ($this->items as $item): ?>
<?php if ($item['isActive'] || $this->level != "level_3"): ?>
<li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><span class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?></span><?php echo $item['subitems']; ?></li>
<?php else if($this->level != "level_3"): ?>
<li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?><?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?><?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?><?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?><?php echo $item['target']; ?>><?php echo $item['link']; ?></a><?php echo $item['subitems']; ?></li>
<?php else: ?>
<?php echo $item['subitems']; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if($this->level != "level_3"): ?>
</ul>
<?php endif; ?>
So what I am doing is to check if there is the "level_3" class is set. If so, do not output any HTML. Only the subitens (level_4).
Hape that helps.