different display views for the same content type summary

Topics: Customizing Orchard
Mar 15, 2013 at 12:46 PM
Hi all! I want to have a number of projections for the same content type e.g article.
I have customized my first projection display, creating a new cshtml file for Content-Article-Summary . But I want the other projection to display article summary with some modifications.And the third with some other modifications.E.g second projection-->image and 1 line of text , third projection -->2 lines of text etc . Is there any way to link a view with a specific projection? In retrospect i want to have a number of different Content-Article-Summary views and link each of them with a specific projection.
Developer
Mar 15, 2013 at 12:57 PM
You can do that by adding multiple Layouts to your Query. Per Layout you can specify a name for the DisplayType. Then, in your various Projections, you select the desired Query + Layout combination.
Mar 15, 2013 at 1:04 PM
Thank you sfmskywalker and btw congratulations for your excellent tutorial on orchard! I have considered this option but it seemed limited to me.Maybe i m wrong.
Does the orchard create a new view file for this query layout?Can i change its content?
Mar 15, 2013 at 1:08 PM
Edited Mar 15, 2013 at 1:09 PM
--edited (double post)--
Developer
Mar 15, 2013 at 4:43 PM
Edited Mar 15, 2013 at 4:43 PM
Thanks!
Based on your requirements stated in your initial post it does exactly what you need, so I don't see any limitations here. Could you elaborate?

Orchard will not create a new view file when you create a Projection Layout - it's merely a DB entity.
What happens is that when you have a new Projection Layout with for example a display type called "SampleSummary", the yielded content items will be rendered with the "SampleSummary" display type. This provides you with the opportunity to create a view file for that particular display type, so that each item will be rendered using that view. You can create a generic content view like "Content.SampleSummary.cshtml" or a more specific one, targeting items of a specific content type, e.g. "Content-Article.SampleSummary.cshtml".

In case you want complete control over the rendering of the entire list and its items, I recommend downloading the Contrib.ProjectionLayouts module. It provides more layout types, including a "Shape" layout, where all you will do is enter the name of the shape that is supposed to render the items and of course create a view file that will actually render the items. This view file will have a model exposing all yielded content items by the query as well as a delegate to a function that will render the items into shapes. It's my favorite layout. :)
Mar 20, 2013 at 12:28 PM
Thank you very much for your detailed answer.It saved me a lot of time and i ve managed to implement what i wanted.Thanx again :)
Sep 14, 2013 at 5:35 PM
Dera gbas,
Can you share some of code sample in this case.
Which place did you make changes or modify.

Thank you.
Sep 14, 2013 at 6:07 PM
I was believing contrib.projectionlayour was incorporated in core with 1.7 ?