Dynamic menu generated based on the content type
[%content_menu content_type:'category' sortby:'sortorder' show_empty:'1'%] [%param header%] Category Menu [%/param%] [%param *level_1%] <a href="[@url@]">[@name@]</a> [%if [@next_level@]%][@next_level@][%/if%] [%/param%] [%param *level_2%] <a href="[@url@]">[@name@]</a> [%if [@next_level@]%][@next_level@][%/if%] [%/param%] [%param *level_3%] <a href="[@url@]">[@name@]</a> [%/param%] [%param footer%] [%/param%] [%/content_menu%]
The content menu automatically generates a navigation tree based on the content type you've selected.
In neto, content types are customisable page types that can have products, pages & related content added to them and sit at the core of our CMS. With this menu tag, you can call any content type you'd like for a nav menu based on the
content_type parameter. By default neto comes with a few types such as category, information pages, blogs, etc. But you can create your very own content types via
Admin > Content Types Manager and use the unique ID you create to link it to a menu.
Start category, categories & you
Something that can cause a little confusion is what role these params play in b@se.
category parameter let's you select a specific content page to generate your menu from based on the ID. So if you'd like to focus on a specific group of parent and child pages in a content type, you can target this via the
id of these content pages.
start_category does a similar thing, let's you target specific content pages to generate your menu from with one big difference - it changes how the
level parameters perceive this content. So let's say you have Category A with a sub category, Category B as a child. A normal menu would print Category A as
level_1 and Category B as
level_2. However, if you use
start_category:'10' (10 being the ID category_b has in this example), then your
level_1 param now prints Category B as the "First level" category because that's where your menu starts.
Note : Both these params often use the
[@id@] data tag for dynamic results based on the current page.
Below are a few quick-start configurations that are useful when building a site, keeping in mind you'll likely need to add some
footer params to throw in some rows and other layout formatting.
Show all next level pages based on current page
Our example uses categories as the default type, but you can swap this out for other content types as needed.
[%content_menu content_type:'category' sortby:'sortorder, name' show_empty:'1' category:'[@id@]' start_category:'[@id@]'%]
Show a list of all the blogs
[%content_menu content_type:'blog' sortby:'sortorder' show_empty:'1'%]
|content_type:''||String||The content type you'd like to target for the menu|
|limit:''||Integer||Sets a limit of items generated in the menu|
||The sort order for the pages in your menu|
||Shows empty content pages as a part of the menu|
|header||HTML & b@se tags||Renders a single usable space above the body|
|body*||HTML & b@se tags||Runs an array for each option in the tag|
|footer||HTML & b@se tags||Renders a single usable space below the body|
|ifempty:''||HTML & b@se tags||If the type selected has no content pages, it will display this content|
|category:''||String||Targets a specific category to generate a menu from|
|start_category:''||String||Targets a specific category at any level to begin the menu from, thus changing what each
|get_fields:''||String||Adding field names here will call the data into the menu, eg.
|level#||Integer||Replacing the # character with a number, this will load the required level data.|
|level#selected||Integer||Replacing the # character with a number, this will load the required level data if the current level is selected.|
|level#_related||Integer||Replacing the # character with a number, this will load the required level data if the current level is related to the selected cateory|
||Counts 1 integer for each result that runs in the menu on every level|
||The unique of the page|
||The current level as an integer|
||The content reference field for that page|
||The unique ID for the parent page of the content|
||Prints true if the page is related to the current page|
||Prints true if the page is the current page.
Allows you to use logic to customise links to the page you are currently on:
||The total number of products assigned to the page (Regardless of product state, includes sold out products)|
||URL to page|
||Loads the next level param, ie.