Getting to the right bit of the Template

Jan 20, 2011 at 12:10 AM

In my theme I'm overriding Content.Summary.cshtml to change how summaries are layed out.

This displays the following zones (not sure if they're still called zones in this context, they might be shapes):

  • Header
  • Content
  • Meta
  • Footer

I want to move where the date, comments link and tags are displayed in relation to each other, but these aren't in this template. Where can I find them? Is there a seperate template for each zone/shape in the template I'm looking at?

Thanks,

Richard Garside.

Coordinator
Jan 20, 2011 at 12:29 AM

The date is rendered by Parts.Common.Metadata.Summary.cshtml, comments by Parts.Comments.Count.cshtml and tags by Parts/Tags.ShowTags.cshtml. Where they appear is determined by their respective placement.info files.

Jan 20, 2011 at 10:23 PM

I've added a Placement.info file to the route of my theme and all works fine.

In case others are trying to do the same it looks like this:

<Placement>
	<Match DisplayType="Detail">
		<Place Parts_Tags_ShowTags="Footer:1"/>
	</Match>
	<Match DisplayType="Summary">
		<Place Parts_Tags_ShowTags="Footer:4"/>
		<Place Parts_Comments_Count="Footer:5" />
	</Match>
</Placement>

This changes were tags and the comment count elements are displayed.

Feb 14, 2011 at 1:21 AM

This is cool but I wanted to structure my footer on one line. I tried the following in my Content.Summary.cshtml:

	@Display(Model.Content)
     <div class="metadata">
            @Display(Model.Meta) @Display(Model.CommentCount) @Display(Model.ShowTags)
     </div> 

But the Model.ShowTags part doesn't work. Any suggestions?

Coordinator
Feb 14, 2011 at 10:45 PM

Those Display calls really are creating local zones. If nothing inserts contents into those zones nothing will happen. Hence your placement file should contain something like this:

<Place Parts_Tags_ShowTags="ShowTags:1"/>

I think.

Feb 14, 2011 at 11:21 PM

I gave it a try, but it didn't seem to change anything. I'm actually trying not to use the placement.info. I'm trying to do handle all of the display through the views.

Which causes the parts/Tags.ShowTags.cshtml to be rendered above the content (I guess the default placement). The metadata and comment count render correctly when placed in the Content.Summary.cshtml as described above. Shouldn't I be able to show the tags from the model as follows. 

@Display(Model.ShowTags)

Thanks in advance,


 

Coordinator
Feb 14, 2011 at 11:34 PM

> I'm actually trying not to use the placement.info. I'm trying to do handle all of the display through the views.

Why?

Well, anyway, Model.ShowTags is not going to do the trick because it does not exist (so it dynamically creates an empty shape, which is the same thing as a local zone). You need to display the actual tags, which you can probably access through Model.ContentItem.As<TagsPart>().CurrentTags