This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi, i can't get any menu items to show up on my layout:
I have:
1) Created five static pages
2) Created a menu (with default name "staticMenu") and added the five pages to it; i have named all of the items, and chosen the type: static page and linked them all to my static pages..
3) Added the Static Menu component to my Layout displaying the static pages.
4) Tried both:
{% component 'staticMenu' %}
on the layout, but nothing is printed.
Also tried to manually create my menu with twig:
{% for item in staticMenu.menuItems %}
<a href="{{ item.url }}">
{{ item.title }}
</a>
{% endfor %}
Also no output.
What am i missing?
Thanks in advance!
Last updated
Did you configure the component properly so that it links to the correct menu? See the blog post on Getting Started with Static Pages, especially image
Last updated
Thanks for the answer.
Yes, i have kept the original alias "staticMenu", and linked to my menu which is called "mainMenu".
My mainmenu.yaml is populated with the correct items (the four pages) in Yaml format.
So it seems i have done everything like in the tutorial you linked to.
Okay i found the problem.
in the top section of the page before the = symbol, i did not have a code = main menu property set.
But the "code" property is not mentioned once in the "static pages" documentation? And in the plugin documentation the description of the property is both cryptic and not accurate?
http://octobercms.com/plugin/rainlab-pages
This quote doesn't make much sense to me:
Add the staticMenu component to the static page layout to output a menu. The static menu component has the code property that should refer a code of a static menu the component should display. In the Inspector the code field is displayed as Menu.
"Should refer a code of a static menu the component", what is a "a code"?
Wouldn't this description make more sense?
Remember to set the code property below your [staticMenu] initialisation. This "code" property needs to refer to the actual name of the menu that the staticMenu alias refers to. (The one you've set in the "Menu option" when adding the component).
Wouldn't that make much more sense? Also why this variable is not automatically set when you add the component and set the "Menu" option i don't get.
Maybe i jumped over some documentation ? :)
Last updated
1-4 of 4