Help with understanding layout/rendering/zones

Topics: Core, Writing themes
Sep 14, 2012 at 5:22 PM

Let's say I have a CustomContentType and it has three fields.

I use a Content-CustomContentType.cshtml to wrap this content the way I'd like.

Then I let each field-name.cshtml to control how each field is rendered.

I need the first two fields wrapped inside it's own <div> but not that last field.

I almost belive my only option is to control the rendering of all 3 fields from the Content-CustomContentType.cshml.

But I've seen in some instances where a zone could have a header,content,footer internal sections.

This would also solve my problem - because I would just keep the first two fields in the content section and then the last field into a "footer" section.  But how can I do that?

I assume the placement.info would allow for this; but I think it only allows me to specify the zone (zone:footer doesn't do it - instead that pushes the field to the footer zone of the page; I want it on the footer area of the object/model)

You see this in the core Content.Summary.cshtml - how did content get put into the "Model.Header,Content,Footer" - it seems that I only have the ability to place it in the Content (default).

Any insight would be appreciated - since I'd rather not do all of the field rendering from the Content-*.cshtm.

Thanks

Coordinator
Sep 14, 2012 at 6:09 PM

That's a pretty good idea to achieve grouping today. Yes, placement will let you do that. I'm not sure why a place with "Footer:1" would not work the way you want. It should send your field to the Footer zone that is defined inside of your Content template. Are you sure you didn't do something like "/Footer:1"? That one would send the field to the top-level Footer zone.

Sep 18, 2012 at 7:31 PM

the place with "footer" did work; I had made a typo that I realized was stupid... (exactly what you said - I used the zone footer instead of local zone) lol

so now I use the local zones to control some level of heirarchy. Of course when using header - need to make sure title and publication etc information is not rendered - so I have to use an alternate for those (essentially empty alerternates).  I try not to use placement.info to hide things too much because I still need access to the data and I lose access to the data when I tell placement.info to hide it "-".

Can local zones be created or is there only three?

(using standard admin UI to build types and a custom theme)

thanks

Coordinator
Sep 18, 2012 at 9:22 PM

You can create whatever zones you want by just overriding or alternating the content.cshtml template.