themes for Orchard 1.5.1

Topics: Customizing Orchard, Writing themes
Aug 5, 2012 at 11:52 PM

I am going to attempt to convert one or more of my Orchard websites to Orchard 1.5.1. However, I was using the Advanced Menu for my menu but understand from reading this forum that the Advanced Menu is or will soon be obsolete; the new Orchard Navigation is supposed to be the thing to use I gather.

I am looking for a theme from the gallery that might make use of the new navigation but cannot come up with any.

One of the things I wanted to do was create a menu in the Aside First zone that is a list of buttons as in which is one of the sites I created with orchard. I would be willing to use a different menu format but my client wanted it to be like this. I had used the Advanced Menu to create it but now will have to figure out all over again how to use the new navigation. One of the things I saw in that new navigation was the drag drop re-arrangement of the menu items. That was slick!

If anybody has any good suggestions that will help me get started that would be great. In the mean time I'll be digging in.


Aug 6, 2012 at 6:11 PM

You shouldn't need a specific theme: the new navigation comes with default templates. Now if you need to override those, you'll be able to do so on top of the theme you chose.

Aug 7, 2012 at 4:19 AM

Thanks. I am making progress and now am just using my own theme. I've tried reading the existing documentation on adding a theme but it seems a bit out-dated although I think I've managed to follow what is there ok.

I saw the discussion at discussion:389747 which indicated I could add a CssClass text field to my menu item part.

So I went to the dashboard then to Content then to Content Parts then to Menu and finally to Fields and clicked Add where I added a TextField and named it CssClass.

I did the same for Content Menu Item (I went to Content, then Content Types, then to Content Menu Item then to Parts and edited Menu to add a CssClass there - also a text field

I did that and then copied the MenuItem.cshtml and Menu.cshtml from Orchard.Core/Shapes/Views into my theme. I was able to modify the 'li' tag with my class, but I also wanted to modify the 'ul' tag with a css class. For the 'li' tag I added the middle line to the two existing lines of code to get this:

    var tag = Tag(Model, "li");

But I couldn't figure out how to get the css class value from my Menu part. So in Menu.cshtml I added the second line here:

    var tag = Tag(Model, "ul");

which is the name of my class. This works ok for me but I figure there must be a better way. I saw the info about the Vandelay Classy but haven't done that yet. I don't want to depend on a third party again like I did with the Advanced Menu so am hoping to find a method that is built in to the Orchard framewori. 

I cannot figure out what to use to replace the hard-coded value of "bt-menuItem" which is the name of the class I'd like to add to that 'ul' tag.

Do I need to use that Vandelay class? Or can I do this just using the content types that come with Orchard.




Aug 8, 2012 at 10:49 AM

When you're in Menu.cshtml, the Model should contain a ContentItem property as well. If you attach a text field called CssClass to the "Menu" content type (note: it will actually be added to the implicit "Menu" part),  you should be able to access it like so: Model.ContentItem.Menu.CssClass.Value.