share ideas two different menu styles (main menu and sidebar menu)

Topics: Customizing Orchard, General
Aug 7, 2013 at 6:27 PM
i have done style two different menu for my project. I thought this may help someone.

I first added a bool field on the content type menu, I named Issidebar (with default value is false)

continue, open the menu that you want, change the value of Issidebar.

then in Menu.cshtml (you can see it in core/Shapes/view), I use it to identify menu in sidebar and add class to style it.

this is code:
@using Orchard.Utility.Extensions
    // Model is Model.Menu from the layout (Layout.Menu)
    var tag = Tag(Model, "ul");
    var items = (IList<dynamic>)Enumerable.Cast<dynamic>(Model.Items);

    bool? Issidebar= Model.ContentItem.Menu.Issidebar.Value;

       tag.AddCssClass("sf-menu sf-vertical");
    else {

    if (items.Any()) {
        items[items.Count - 1].Classes.Add("last");
        @* see MenuItem shape template *@
done. happy day

P/S : Sorry about my english, it is not my main language, but I hope you can understand. :):)