This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Is it possible to do something like this for the static menu component?
{% component 'staticMenu' code='menu-item-code' %}
I'd like to set the menu identifier from code so that editors can include a menu on a page and select which menu they want to show through a snippet. If I understand correctly, the code used to identify the menu is the filename without the .htm extension. I would expect it to work as shown but it doesn't.
In your Plugin.php file add the code below. If you need something more advanced you can write a component to extend the StaticMenu component.
public function registerPageSnippets()
{
return [
'\RainLab\Pages\Components\StaticMenu' => 'staticMenu',
];
}
daftspunk said:
Try this
{% set links = staticMenu.resetMenu('menu-item-code') %}
dont work for me :( ....
Hey, i've the same issue and i've make it different, i need to use the staticMenu component 3 times in the footer but with the same design, so, i've load 3 times the component with different menu:
[staticMenu staticMenuBottom]
code = "shop-departements"
[staticMenu staticMenuAccount]
code = "mon-compte"
[staticMenu staticMenuBottom]
code = "shop-departements"
[staticMenu staticMenuAbout]
code = "a-propos"
and run in my html like that:
<div class="widget widget-links widget-light pb-2 mb-4">
{% partial 'staticMenuBottom/default' menuName=staticMenuBottom.menuName items=staticMenuBottom.menuItems %}
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="widget widget-links widget-light pb-2 mb-4">
{% partial 'staticMenuBottom/default' menuName=staticMenuAccount.menuName items=staticMenuAccount.menuItems %}
</div>
<div class="widget widget-links widget-light pb-2 mb-4">
{% partial 'staticMenuBottom/default' menuName=staticMenuAbout.menuName items=staticMenuAbout.menuItems %}
</div>
It's works fine, thanks to neilcarpenter for the help !
Last updated
It's works fine, thanks to neilcarpenter for the help !
You're welcome :)
Last updated
1-7 of 7