{{* Get all menu items that have no parents  *}}
{{getTreeChildNumberAdmin var=primaryCategories CID=276 Level=1 NoDisplay=1}} 
{{* To be able to highlight the current menu, we do the folowing *}}
{{assign var=filename value=$smarty.server.REQUEST_URI}}
{{* If somewhere in the code we want to highlight something else , the folowing lines do that *}}
{{if $fileNameToUse neq ''}}{{assign var=filename value=$fileNameToUse}}{{/if}}

{{* We get the data for the selected item *}}
{{getCollectionByCategory CollectionID=276 ColumnID=2 Value=$filename OrderColumn=1 var=CurentPageDatas}}
{{assign var=CurentPageData value=$CurentPageDatas[0]}}

{{* We get all the parents of the selected item and we save the one that has no parents *}}
{{getTreeChildPath CID=276  Node=$CurentPageData.Collection_276_ID var=ParentPath}}
{{assign var=FirstParent value=$ParentPath[1]}}

{{* Time to display the menu *}}
<ul>
{{assign var=first value=0}}
{{foreach from=$primaryCategories item=v key=k}}
{{if $v.Collection_276_4 eq 'on' and $v.Collection_276_5 eq '' }}

	{{* For EIP. We need to decide weather we want the logined user to be able to right click and edit the menu item *}}
	{{assign var=canAccess value=0}}{{if $smarty.session.UserID gt 0}}
	{{CollectionCanAccess userId=$smarty.session.UserID CollectionId=276 rowId=$v.Collection_276_ID var=canAccess}}{{/if}}
	<li><a href="{{$v.Collection_276_2}}" {{if $canAccess eq true}}collectionid="276" collectionrowid="{{$v.Collection_276_ID}}" collectioneditor="1"{{/if}} {{if $v.Collection_276_2 eq $filename or $v.Collection_276_ID eq $FirstParent}} class="selected"{{/if}}>{{$v.Collection_276_1}}</a></li>
{{/if}}
{{/foreach}}
</ul>