Need to Query Layout in Orchard

Topics: Core, Customizing Orchard, General, Writing themes
Aug 16, 2012 at 2:40 AM
Edited Aug 16, 2012 at 3:00 PM

Relatively Innocent Part

I think there is one layout that is needed in the projection module that currently doesn't exist...a repeat layout. It would compliment the Grid and the List, because it would contain NO markup other than just repeating the content items (and their respective template renderings).

After reading Bertrand's few blogs on customizing the list views (so please for the love of God don't point me there) and trying to create a Image Carousel layout to no avail, I think it would be great if you could just render a sequence of items from the database with no markup. For example, for my food list it would render:

EggsHamBacon instead of


<ul default-garbage>


I know that when you read this Bertrand that you are going to say "Why on Earth would you want to do that?" The answer is that it is relatively common in my experience to need to render a sequence of items outside of the standard <ul> or table patterns. I don't want to have to go to the module level to be able to get this simple functionality. With such a simple layout, I could create the above ul way if I wanted, but could also just render:




With a small change to my Food.cshtml file. I don't wan't to have to get the Orchard source code and debug anything. This needs to be available out of the box.

Aug 16, 2012 at 5:51 AM

Nice Part

Extending the layout providers doesn't look that difficult, but if you really want to stay out of the code, couldn't you just use javascript/css to get the effect you want?  I know you said it's a common scenario, but I'm having trouble thinking of a scenario that I would need it.  Anyone else?  It doesn't seem to me like it would deserve to be a core feature.  As a user seeing a string of text from multiple content records would just be confusing.  

Mean-ish Part

Yes, Orchard is a big thing, but I wouldn't call it ridiculously complicated.  Point to an unnecessarily complex feature/code in Orchard and I know it will be looked at very seriously.  Being as flexible a system as it is, it's bound to have a lot of abstractions and moving parts.  This is all necessary in order to keep a maintainable system.  I'm elated to know that this project is being designed to float into the future in a sea of CMS's that are giant sinking turds. 

You know that Microsoft doesn't own Orchard right?  When Microsoft tools are not right for the job, we can use something else.  Look through the lib folder and modules and see how many non-Microsoft shoulders we're standing on when building an Orchard project.  As for keeping with the framework, If having a changeset for Visual Studio 2012/MVC 4 the day it's released is not keeping up...I don't know what is.  

There is nothing in Orchard keeping you from using a controller, so I don't understand that part.  Have you tried adding a controller?  You can hijack routes as well.  Orchard is extremely friendly for control freaks.  You can override almost any dependency, template, controller, route, script, event handlers, etc.  

I'm sorry you're frustrated, and I've honestly been there before too, but getting familiar with Orchard's architecture has been a huge win for me and the projects that I work on day to day.  I urge you to keep at it, and give feedback whenever you can so the project will improve.  I hope that helps you in some way and wasn't too mean.  :)

Aug 16, 2012 at 3:39 PM
Edited Aug 16, 2012 at 3:41 PM

Thanks for your kind reply Brandon. I should follow a good internet code of conduct rule and never post when emotionally charged. I will stick with it and try to figure out more. As for the examples of when it is handy:

Several javascript widgets I have been working with require the <span> tag to divide the list of items up. Also, with the trend of one page apps, I have seen several "views" that are divided as <div>'s on a page and the javascript framework can call those when needed.

Basically, I think it just adds that extra bit of flexibility where Orchard doesn't decide how you want to display items from database.

Aug 16, 2012 at 7:12 PM

I see how that could be useful for that scenario.  Are you thinking at all about building a module for it?  Sometimes features make their way into the core distribution by being a module first.  I think the Advanced Menu Module would be a pretty good example of that.  It's a good way to test the waters and see how much of a need there is for it.  Just an idea.