How to set Menu class attribute?

Topics: Customizing Orchard
May 11, 2012 at 4:40 PM

@{
    // Model is Model.Menu from the layout (Layout.Menu)
    Model.Classes.Clear();
    Model.Classes.Add("art-hmenu");
    var tag = Tag(Model, "ul");    
}

    @tag.StartElement
        @* see MenuItem shape template *@
        @DisplayChildren(Model)
    @tag.EndElement

 

I'm very new to the Orchard project, so.......

I am trying to change the menu display using the code above in my  customize Menu.cshtml template.

This works, but I don't uderstand how the Model.Classes is initially populated.

also...

I'm not sure if this is the correct approach to customizing the look of the Menu.

Any help appreciated.

Regards,

Paul.

Coordinator
May 12, 2012 at 9:39 PM

Model.Classes can be seeded by pretty much anything that runs before the view gets rendered. Typically, it can be the parent shape, or the driver. What you've done looks fine.

May 14, 2012 at 8:48 AM

I'm new to Orchard, so It's good to be reassured I'm doing it right.

Thanks for your help.

Regards,

Paul.