Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top