Loading a zone from within a widget alternate?

Topics: Customizing Orchard, General, Writing themes
Sep 28, 2011 at 9:06 PM

The problem is basically what's in the title. I have a zone that I need to be loaded from within a specific layout alternate, and it doesn't seem to be liking the simple idea. I tried @Display(Model.Parent.AssetContainer), as that seemed to be what the model wanted, but it isn't working at all... any pointers?

Sep 28, 2011 at 9:31 PM

Can you explain why you need to do that? And also what it is exactly you are trying to do, I'm kind of confused by the question actually.

Sep 29, 2011 at 2:00 PM

I realize this may not be the "right" approach, but basically I have two different "page" types, both of them using alternates for their layout. I need a container widget added to just one of those types, and I couldn't think of another way of doing it.

Sep 29, 2011 at 5:19 PM

So you just need to declare a zone in one of the layouts and not the other? Well, that should just work: @Display(Model.AssetContainer).

Sep 29, 2011 at 5:39 PM
Edited Sep 29, 2011 at 5:39 PM

I thought so too, but it's just not working. This is the code for Content-Asset.cshtml:

<div id="upper" class="asset">
    <div class="thumbnail">
        <img src="@Model.ContentItem.Asset.CTAVideo.Value" />
    <div class="cta">
    <div class="fix"></div>
<div id="lower" class="asset">
    <div class="left-nav">
    <div class="content-body">
    <div class="fix"></div>

Sep 29, 2011 at 5:49 PM

No, in your alternate layout, not in content-asset.cshtml.

Sep 29, 2011 at 6:10 PM

Unfortunately, that's where this needs to go... I think I pieced together a method using a new Layer that will let me accomplish what I need. Still learning the nitty-gritty about Orchard.

Sep 29, 2011 at 7:50 PM

If you have to do it from there, you might want to try @Display(WorkContext.Layout.AssetContainer)