How To Build A Dynamic Menu In ExpressionEngine?

How To Build A Dynamic Menu In ExpressionEngine?

Structure

We can get the structure add-on form devotee third-party site. To install this addon, you have to uninstall the add-on if it is installed on your website.

Pages

To create the navigation, we have to assign page types to a particular channel which we want to use as navigation. Pages show up in Structure navigation tags and the main CP site tree. Pages is also a container of the listings. In pages, we have to select the template which is used as display content on the page when the structure URL of that page will be open at the front side.

Listing

To create listings, we have to assign the listing types to a particular channel. Listings must be connected with one page and channel to enable easy adding and editing. Listing types entries do not display in the structure navigation, but we still set URLs and Structure data posted to them. Listing is generally used for a list type of data that shows on a single page and clicks on it to go to a detail page. Means it will auto-create the details page URL using the listing. For an example — listing of products, blog posts, etc. If something consists of multiple entries and does not need to appear within the site navigation, listings are a proper solution.

Assets

To create listings, we have to assign the listing types to a particular channel. Assets do not contain page URLs and it means that it is the just information that will be shown on the other templates and sections of the pages. For example banner ads in the pages and entries which are related to the page. Assets are normal channel entries, so they can still get through the normal templating system when needed.

Provide Channel Setting

We need to decide which channel is used for which types and template options.

Provide Channel Setting

Create the page

To click on the “Add Your First Page” button.

Create the page

Add Navigation At The Front Side

To add this navigation at the front side, we will add the “exp:structure:nav” templated tag.

NavEE

NavEE is used to managing navigation in a simple way without any limitation. It provides the ability to manage multiple navigations. If your site has lots of different navigation sections then this addon is more suitable for your website.

Create Navigation Group

We have to first create a navigation group and then individual navigation items inside of the group. Individual navigations are displayed in a tree view, so you can set hierarchy (tree structure) and order.

Create Navigation Item

We have clicked on the “Top Navigation” link to add the navigation item inside it.

Create Navigation Item

Add Navigation At The Front Side

To show this navigation at the front side, we have to use the template tag “exp:navee:nav” tab in the template.

Output At The Front Side

Conclusion

To use the above “NavEE” and “Structure” addons, both addons are best according to our website’s needs. However, NavEE addon is the most suitable when we want to use multiple navigations on our website. NavEE also works with the “Pages” module so we do not need to remove the Pages module for NavEE addon setup.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store