Ticket (Solved)

Unable to change Widget to different Zones via Placement.info?

Hi all, If I have,

Placement>
Place Parts_FeaturedItems="Content:1"/>
/Placement>

The widget renders as expected, but if I change it to another Zone, say:

Placement>
Place Parts_FeaturedItems="AfterContent:1"/>
/Placement>

The zone nor the widget displays, is there something else I have to do to activate zones other than the 'Content' one? Thanks for your assistance, Pug

Re: Unable to change Widget to different Zones via Placement.info?

The placement file enables you to place part and field shapes into local zones, which are child zones of the Content shape representing the content item/widget being displayed.

If you want to display those shapes in global zones instead, you can do so by starting the zone name with a forward slash, like so:

<Place Parts_FeaturedItems="/AfterContent" />

Monday, July 25, 2016 9:26:51 AM bysfmskywalker

Re: Unable to change Widget to different Zones via Placement.info?

I see, I have misinterpreted a great many things/examples then (but they all make sense now) - so are my aspirations to create custom Zones in a view even possible [BTW, the "/" i.e. /AfterContent in the placements file does indeed work].

...It's obviously not as simple as what I have here (or it would work- ha!):

@using Orchard.ContentManagement
@using Orchard.Layouts.Models
@{
    var list = Model.List;
    var pager = Model.Pager;
    //From Layout.cshtml
    Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones

    if (list != null)
    {
        var webPages = ((IEnumerable<ContentItem>)list.ContentItems).ToList();

        foreach (var wp in webPages) {
            var layoutPart = wp.As<LayoutPart>();
        <div class="tensite-wrapper">
            <div id="zone-tensite-slider">
                @Zone(Model.SliderProjSummary)
            </div>
            <div id="tensite-info">
                @Display(BuildDisplay(layoutPart, "ProjectionSummary"))
            </div>
        </div>
        }
    }
}

Placement.info

  Match DisplayType="ProjectionSummary">
    Place Parts_FeaturedItems_ProjectionSummary="/SliderProjSummary"/>
  /Match>

Do I have to declare the custom Zone like what's in the Theme.txt, perhaps? Thanks for your support Sipke, very much appreciated!

Monday, July 25, 2016 11:58:45 AM bypug
  • pug
  • Lv. 04 Rookie
  • Total EXP: 144

Re: Unable to change Widget to different Zones via Placement.info?

Hi Sipke, I note in your: http://www.ideliverable.com/blog/a-closer-look-at-content-types-drivers-shapes-and-placement that you refer to [zoneHolding: "…If the Layout shape were a regular shape (deriving from Shape) then you would have to first new up the zone shape you want to add, and then assign it to a property on the layout." This gives me hope that one can add Custom Zones arbitrarily but unsure if it would work with a standard view.cshtml/alternate file? Would I have to replicate my view [above] as a shape that derives from zoneHolding to achieve this, and if so, are there in any working examples in Orchard? Your answers have been invaluable thus far, so I appreciate your thoughts greatly. Thanks Pug PS> Not sure how my previous reply to yours has appeared above your reply -haha

Monday, July 25, 2016 11:18:55 PM bypug
  • pug
  • Lv. 04 Rookie
  • Total EXP: 144

Re: Unable to change Widget to different Zones via Placement.info?

Although (in my mind, ha) I was referring to my last post with this topic, I now understand I'm going off-topic from the original question which has really been answered by Sipke, so I have started a new ticket http://orchardpros.net/tickets/10839 instead. Thanks guys, and especially Sipke.

Tuesday, July 26, 2016 8:57:04 AM bypug
  • pug
  • Lv. 04 Rookie
  • Total EXP: 144

Post a reply

You need to be signed in to post a reply.

Sign In