This project is read-only.

Changing the way the zone is rendered

Jan 27, 2011 at 1:11 AM

I am looking fro a way to change the way a zone is rendered.  Based off the reading from the docs, I was hoping that I could just create a file called something like Zone-Header.cshtml.  But I can't find any information on what might be required to put into the file to make sure that the widgets, etc that should be rendered get rendered.  Also is is possible to add a @Display(Model.ZoneName) in a zone file.  Basically what I want is to change the wrapping element of the zone (i.e. <div class="zone zone-header">) to something else as well as have the navigation zone get rendered inside of the header zone.

Any guidance would be appreciated.

Jan 27, 2011 at 1:18 AM

You can find the default rendering for zones in CoreShapes.Zone. It's in C# but you can put equivalent HTML in a template file appropriately named.

Jan 27, 2011 at 3:11 PM

Thanks for the info, I actually already got that far.  my problem really seem to be in the loop.

The Zone method you pointed to has this:
foreach (var item in ordered_hack(Shape))

I know I have access to a @Model.  but how do I loop through the shapes that is contains?  @Model is dynamic so no intellisense really.

I would think it would go something like this:
@foreach (var shape in Model)

but the problem is that Model has some things that aren't shapes.  Like Model.ID and Model.Classes. 

Jan 27, 2011 at 3:25 PM

And actually I guess I should clarify, that the above foreach is working for me.  But I just am wondering if this is the right way because of the things that aren't actually shapes like Model.ID and Model.Classes.  Although those don't seem to get rendered, they have to be getting included in the loop somehow.

Jan 27, 2011 at 4:53 PM

I think Model.ContentItems.Items should be enumerable.

Jan 27, 2011 at 5:15 PM

Cool i will look at that, but I also found 


works great and very clean, unless you know of a reason not to I think this is the way I will go.