This project is read-only.

Working with Lists

Topics: Customizing Orchard
Apr 13, 2011 at 9:36 PM

Hi All,

Loving Orchard, what a cool platform.

I have a simple requirement that i am struggling to make work.

What i want is to have 2 things.

1. I currently display lists and have customised the rending to include URLs links for certain text fields as per the doco, how can i also display just the title of a blog as a list item without everything else? I would like to retain my normal list rendering and have this as a seperate option

2. How can i create lists of lists.. so that way i can have a multiple blogs and this could be displayed in a widget as a list of all my blogs?

Apr 13, 2011 at 10:37 PM

1. If I understand this correctly you want to have a template variation so you can choose to render certain lists differently. There are various ways to vary templates and which one is appropriate depends on your criteria. Each shape in Orchard has a number of "Alternates". You can see all the Alternates if you enabled the Designer Tools / Shape Tracing feature and inspect the appropriate page region using the Javascript UI. By default the system is looking for Alternates based on the content type name, or on a specific item Id. The Shape Tracing tool has a Create button to quickly generate a copy of the appropriate template in your theme. If your criteria are more complex than that then you will have to code a custom solution. You could for instance add a part that gave you a dropdown box allowing you to select different template alternates. I made a module that allowed switching the Layout template in this manner but it sounds like you want to customise a different template. My module is here if you want an example of how to do this: ... if you need any more help let me know, I've been meaning to update that module to allow overriding templates other than Layout, perhaps I could get that done quickly tomorrow :)

2. This sounds quite easy, you can add the "ContainablePart" to an existing "ContainerPart" type, and then it both be held within lists as well as being a list.

Apr 13, 2011 at 11:36 PM
Edited Apr 13, 2011 at 11:41 PM

Thanks Pete,

To clairfy i want to have a list rendered different depening on page and/or widget....

An example

My home page will display the list in the secondaside region and only show the title of the list items with the link

Then i would like another page that would display the same list items with all the content in say the content region.

The reason for doing it this way is i cant seem to tag a content item to more than one list....

The second question of displaying lists as a list would only be one display of just the title.

Apr 14, 2011 at 10:42 AM

You can customise the templates used when content is in a widget or on an particular page. So you can use the ContainerWidget to display the list in the second aside region on the homepage, and then use Shape Tracing to discover which template you can customise.

Now - there's a limitation in Container/Containable that means you can only have any item in one list.

This is why I'm working on a module that allows flexible n:n relationships between content items and would let you do this :)

Hopefully it'll be ready by the weekend for people to use, there are still some aspects I'm working on but it's getting there.

Apr 14, 2011 at 12:23 PM

Legend, thanks mate.. loving the community support.