Why placement.info doesn't work for List core shape

Topics: Writing modules
Jul 26, 2011 at 4:21 AM

When displaying a container content item (List content type), it will list all contents that belong to itself.

I can see from the shape tracing, the List shape is used to display the whole list.

I try to use <Place List='-' /> hide the shape, or <Place List="Content;Alternate=xxxx" />to specify alternations, but it doesn't work. why?

I actually want to customize the List, I know I can overwrite by placing List.cshtml in the theme, but it will change every single list in orchard because List shape is shared globally.

Is there a way I can specify the custom List shape for a particular content type, like:  List-NewsList.cshtml

Cheers,

Coordinator
Jul 26, 2011 at 6:37 PM

Some information here: http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx and http://weblogs.asp.net/bleroy/archive/2011/05/23/orchard-list-customization-first-item-template.aspx

Jul 27, 2011 at 1:46 AM

the above two links do not answer my question.

In the articles, you overwrite post list shape using Parts.Blogs.RecentBlogPosts.cshtml template because there is an alternation.
But in my case, there is no alternation for List shape except List.cshtml which I don't want to overwrite because it is used globally.

I try to create an alternation for it using placementinfo but failed, for example, the NewsList has container part:

<Match ContentType="NewsList">
    <Place List="Content;Alternate=NewsList_List" />
</Match>

above doesn't work.

 

Coordinator
Jul 27, 2011 at 8:56 PM

The above links were not meant to give you a ready to use solution to your specific problem but rather to give you hints on how you could go ahead and find a solution. The seconf link in particular shows how you can intercept the creation of a specific list and manipulate it on the fly before it gets rendered. The reason why your placement won't work is that NewsList is not the content type, it's the name of your specific list. I'm afraid you'll have to write a bit of code. This may also help: http://weblogs.asp.net/bleroy/archive/2011/01/10/orchard-shapeshifting.aspx