0
votes

I setup a custom content definition, query and projection to show these content definitions and then setup a Content-[ItemType].Detail.cshtml to fully customize what that item looks like. The problem I'm running into is it puts the detail view for this under Model.Content (in Layout.cshtml), but I'd really like to throw the detail view for this content type into a zone called LargeLeft instead.

For example, I have the below which is used when the LargeLeft zone shows up with one called SmallRight (which works really well for its own part):

          @* large left bar, small right column *@
          @if (Model.LargeLeft != null && Model.SmallRight != null) {
            <div class="col_12">
              @Zone(Model.LargeLeft)
              @if (Model.SocialMedia != null) {
                @Zone(Model.SocialMedia)
              }                  
            </div>
            <div class="col_4">
              @Zone(Model.SmallRight)
            </div>
          }

Since my custom content type just maps to Model.Content, the above isn't seen and it gets thrown in here instead:

              @if (Model.Content != null) {
              <div class="col_16">
                @Zone(Model.Content)
                @if (Model.SocialMedia != null) {
                  @Zone(Model.SocialMedia)
                }                
              </div>
            }

I figure this is something with placement.info, but since I'm not trying to shift individual parts (my designer wanted full HTML control, hence overriding the template) and need to put the whole thing in a specific zone name I'm a bit lost.

Any ideas?

1

1 Answers

2
votes

Well, I suppose you could explain your designer that he does have full control over the html...

You can send a shape to an top-level arbitrary zone in placement.info using a slash in front of the zone name.

It is also possible to add a shape to a top-level zone from code using Layout.ZoneName.Add(yourShape).

More about building markup for a type without using placement: http://weblogs.asp.net/bleroy/easy-content-templates-for-orchard-take-2