This project is read-only.

overriding the menu templates

Topics: Customizing Orchard, Writing themes
Feb 19, 2013 at 9:24 AM
I think this should be simple, but I am new to Orchard. I'm attempting to override the layout (template?) for the main navigation menu in a custom theme. All I need to do is add a class to the ul tag, but I can't quite figure out how to do it.

I have copied menu.cshtml into the Views folder of my theme. I'm having trouble making head or tails of the code in this file. How can I get access to the actual HTML output?

Feb 21, 2013 at 2:46 AM
Edited Feb 21, 2013 at 2:47 AM
What you see in Menu.cshtml, the one in Orchard.Core/Shapes/View, is building the actual HTML. The one you care about in this instance is the tag variable, which is building the outer UL tag with the data available on the current shape (the Model). So in your case, all you have to do to add your class is to add this line to your own copy of the file (that you should put under the Views folder of your theme), right before the line that defines the tag variable (line 3):
That will add the "my-menu" class to the UL tag.
Feb 21, 2013 at 2:49 AM
Bertrand, Thank you. This clears it up for me.