1

I have the requirement to create a different structure for the homepage of my Orchard site.

I learnt that if you use layer 'TheHomepage', when you are rendering the homepage the widgets get run and the relevant Model.[ZoneName] property is set with the Zone (or shape or whatever it is, not got that far) that gets passed to Layout.cshtml.

So far so good, now what I want is that I want to only have these custom zones on my homepage. So I have added the following zones for testing:

HomeMagazine_1 and HomeMagazine_2

When I attach a widget to these zones, and I am on the homepage the widgets get run, and I can see the Model.HomeMagazine_1 and Model.HomeMagazine_2 on the Model passed to the Layout.cshtml.

My issue is that I want a custom page to render these zones. So I have added a new view:

Content-url-homepage.cshtml

Where I am rendering the zones:

<div class="container">
@if (Model.HomeMagazine_1 != null)
{
@Zone(Model.HomeMagazine_1)
}

However the issue is that the Model that gets passed into Content-url-homepage.cshtml is a ZoneHolding that has no HomeMagazine_1 property.

I understand the reason for this, what I am asking is how to acheive what I have illustrated, is there any way to get to the Layout.cshtml ZoneHolding. I'm unsure because the Layout.cshtml is executed after Content-url-homepage.cshtml.

Enjoying working with Orchard but it does throw some interesting blockades up sometimes!

1 Answer 1

1

I have found that I can use:

Layout.HomeMagazine_1

Which has the intended effect. I shall mark this as the answer when I can unless anyone has a better suggestion on how to achieve this.

1
  • 1
    That's the right way. I'm doing it myself in some of my themes. Mar 7, 2014 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.