menu.xml is used to display the menu for each module. Each module has one menu file:

  • configs/frontend/menu.xml
  • configs/admin/menu.xml

menu.xml sample code:

<menu>
	<id>1</id>
	<type>horizontal</type>
	<display>1</display>
	<item>
		<title>Home</title>
		<link>page/home/</link>
		<target></target>
		<external>0</external>
		<isLogged>1</isLogged>
		<notLogged>1</notLogged>
		<subItems>
			<subItem>
				<title>About Us</title>
				<link>page/about/</link>
				<target></target>
				<external>0</external>
				<isLogged>1</isLogged>
				<notLogged>1</notLogged>
			</subItem>
		</subItems>
	</item>
</menu>
  • id tag is used to register the menu. To parse the menu that has id 1, you need to use {MENU_1} in your tpl file
  • type – menu can have submenus (horizontal/vertical) or not (horizontal_simple / vertical_simple)
  • display tag is used to show/hide the menu

There are a few options that can change the behavior of the menu link:

  • target (_blank value will open a new tab, leave empty by default)
  • external (if true then the final link will no longer have {SITE_URL}/ on the left side)
  • isLogged (if true the link will only appear for a logged user)
  • notLogged (if true the link will only appear if no user is logged in)

There is one exception in the menu behavior: if link tag has no value then the menu will act as a javascript button show/hide its submenu – the page won’t be refreshed.
Links should always have / (slash) at the end but not at the beginning.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>