How can I render the full contents of the 'tree' down thru all Container --> Containable branches?

Topics: Customizing Orchard, Troubleshooting
Aug 17, 2012 at 2:54 AM

Hi, this seems simple and I would have thought a common requirement
but I can't get it or find the soultion:

I have a ContentType, say ListofCarBrands (which is a Container)
and contains a list of ContentType CarBrand (which is a Container and Containable)
and contains a list of ContentType CarModel (which is a Container and Containable)
.... and so on, so just your basic taxonomical tree structure.

How can I render this is the front end so that I can get the whole tree on one page?

So far I can find where Parts.Common.Body.Summary.cshtml render a detail-summary
(Model.Html) but I cannot access any of the Models collections.
I'm thinking now the Model object I'm getting here is not, say, a CarBrand instance but some kind of ViewModel created upstream and not including collections.


(In MVC this was easy to do. The view would know what the model being passed in was
(i.e. not dynamic) and I'd just write nested foreach loops)

In addition messing with Parts.Common.Body.Summary.cshtml feels wrong as its not granular enough, it would affect all tree-like ContentTypes.



Aug 27, 2012 at 7:15 AM

You'll want to learn about alternates in order to be able to override a shape for a specific content type.

If you want data to be available in your model, your driver will have to prepare it (just like in MVC, your controller would have to prepare it).