I'm learning Orchard and I did some Pluralsight course. It covered Part Templates, but now I'm reading this article: Anatomy of a theme and there's a section called: Item Templates. And I'm confused. I think I haven't came across this notion before. What is the difference? Let's have a sample that I have a content type Movie with content part Movie. I can override how it's rendered using Part Template. So where I would use Item Template in this case?
相关问题
- Orchard CMS- Configure Base URL
- Orchard - Search & Indexing issue
- Orchard CMS: Sign Out (Log Off) Confirmation Page
- Can't open .sdf file in VS 2012: Unspecified e
- Routing a custom controller in Orchard CMS
相关文章
- Trying to hide Content Parts on Content Type
- Join Non ContentPart Table to ContentPart Table Us
- Orchard CMS on Load Balanced web servers
- orchard cms routing question
- How to fetch table data from database in Orchard C
- How to deploy an Orchard CMS site, including all s
- Orchard Custom Form DropDownLists
- Customizing the Orchard navigation menu
Wrote a blog post with a tiny bit more detail in regards to this question. Shameless plug: http://arkleseizure.net/what-the-hell-is-an-item-template
The wording is not particularly clear I would agree. So let's see if we can clear this up a little...
Content Type: Movie
(So you have a content type called movie with 3 parts attached to it).
We want all the parts to be displayed in the detail view and only the TitlePart displayed in the Summary display. So we use placement.info
(Explicit notation used for clarity)
Placement basically defines where your content parts will be placed for a content type. Summary, Content and Movie are "zones" within a content item that you assign parts to so they can be displayed. So let's go ahead and define our Content and Movie zones in a file called Content-Movie.Detail.cshtml (This would be an "Item Template").
And one for summary, Content-Movie.Summary.cshtml
(You can use the shape tracing tool (http://docs.orchardproject.net/Documentation/Customizing-Orchard-using-Designer-Helper-Tools) to generate these for you and it will create default zones (Header, Meta, Content and Footer, I believe) and the relevant html.)
Our parts should now be displaying in the right places and we may want to change how the title is displayed. So we can create a "Part Template", Parts.Title.cshtml
So in summary. Content Types are made up of lots of Content Parts. Part Templates override the Content Parts and Item Templates override the layout of a Content Type where Zones are defined. Placement.info direct Content Parts to the zones to be displayed.
Hope that helps!