Developer Documentation
Getting started
Overview
Semantic elements
Deployment
Alahup! Elements > menu item (mi)
tag : mi
parents : menu, mis
children : ml, mis (exactly these two elements, in this order)
The menu item element is quite tricky !
It holds exactly two elements :
-
a menu label element which holds the label of the menu item.
Use {render item=$this.ml} to render the label.
-
a menu items element (note the plural !) which contains other menu item elements (sub-items of current element).
Use {render item=$this.mis} to render the sub-items.
Additionally, several essential variables are provided.
-
$this.href
Contains the value of the link (what you would put in >
-
$this.linkAttributes
A convenience variable which equals to ' Also automatically adds target="_blank" if "open in new window" was checked.
Thanks to this variable, all you need to make a working link is this : <a{$this.linkAttributes}>...</a>
-
$this.linkTest
Returns true if the link is "active".
For example, if the link equals to "en/products", $this.linkTest will return true in pages whose url is "en/products", but also "en/products/alahup", "en/products/..."...
-
$this.linkTestStrict
Same as $this.linkTest, but returns true only when the url equals to the exact link (returns false for "en/products/alahup"...)
-
$this.menuDepth
Depth of the menu item. Starts with 1.
Alias of the menu element it belongs to. Useful to test the menu's variables. Example : {if $this.menu.custom.type == "horizontal"} ...
-
$this.menu
Example
<a{$this.linkAttributes}>
{* render the label *}
{render item=$this.ml}
</a>
{* render sub-items if active *}
{if $this.linkTest and count($this.mis.children)}
<ul class="{$this.parent.custom.type}">{render item=$this.mis}</ul>
{/if}
</li>