CMS Development

SvenVanbrabant
Contributor

Displaying menu items twice on web page

SOLVE

I would like to display a particular menu twice on a web page.

 

In the first section the user is able to set up the menu thanks to the following code

{% simple_menu "secondary_menu" label='Secondary Menu' %}

 

In the second section where I just want to display the menu I put the following code

{{content.widgets.secondary_menu.body.html}}

 

However, this seems not to work. Can anyone help?

 

Thanks!

 

0 Upvotes
1 Accepted solution
Jsum
Solution
Key Advisor

Displaying menu items twice on web page

SOLVE

@SvenVanbrabant,

 

You need to export the menu to the template context:

{% simple_menu "secondary_menu" label='Secondary Menu', export_to_template_context=True %}

Then make sure that your reference to this is correct. I haven't actually done this with a simple menu but I know it doesn't work with an advanced menu.

 

You can use the developer info, by going to the page and clicking the "sprocket" in the top right to select developer info, to find a break down of the module as JSON. Use this to construct your reference to the module.

View solution in original post

0 Upvotes
1 Reply 1
Jsum
Solution
Key Advisor

Displaying menu items twice on web page

SOLVE

@SvenVanbrabant,

 

You need to export the menu to the template context:

{% simple_menu "secondary_menu" label='Secondary Menu', export_to_template_context=True %}

Then make sure that your reference to this is correct. I haven't actually done this with a simple menu but I know it doesn't work with an advanced menu.

 

You can use the developer info, by going to the page and clicking the "sprocket" in the top right to select developer info, to find a break down of the module as JSON. Use this to construct your reference to the module.

0 Upvotes