Contents tagged with Zone

  • How To Put Content In Two Zones At Once

    There are a number of ways to do this (as with most things Orchard!) but one way that we’ve found that is both easy and very useful is to store the value in the WorkContext.Layout. Because it’s dynamic you can add your own property and access it from anywhere else.

  • Wrapping Content Item Zones In Custom Markup

    When it comes to rendering a given content item, Orchard splits it in a zones, like Header, Content and Footer. The markup produced by each of the parts contained in an item is then dispatched to one of those zones. That is what Placement.info files are mainly used for – they tell the rendering engine in which zone to put a given shape’s final markup.

    But what to do if you’d like to have the whole zone (eg. a Header) wrapped up in some custom markup? And what’s more – you’d like it to do in unobtrusive way, so no matter how the whole item is rendered (whether there are some shape alternates or not) – you want a given zone to be always displayed as you want it to be.

    I’ve recently came up with a nice technique for doing that. First of all – zones inside a given content item are nothing more than… ordinary shapes! So you are free to attach a wrapper to them.

  • Through The Looking Glass

    In the first tutorial we looked at some of Orchard's built in Clay behaviours, specifically the Zones behaviour. In this part we'll dig a little deeper and actually start writing our own.

    You might already be familiar with IShapeTableProvider. This event handler is used all over the place to modify the shape output of Orchard. Commonly this is used for adding Alternates for template picking, or injecting custom values into the shape to display in the view.

    Something else you can do is add an OnCreating handler as I'm doing here, and one of the things you can do in this event is add new behaviours to a shape.

  • So what are zones really?

    There is a (not so) particular kind of shape in Orchard: zones. Functionally, zones are places where other shapes can render. There are top-level zones, the ones defined on Layout, where widgets typically go, and there are local zones that can be defined anywhere. These local zones are what you target in placement.info.

    Creating a zone is easy because it really is just an empty shape.

  • What happens when I request a page in Orchard?

    If you look at a typical request for a page, the route will resolve the URL to the Display method of the ItemController in Orchard.Core/Routable/Controllers. That action will retrieve the content item for that route from the content manager and ask it to build the display. The ShapeResult it will produce is what is returned by the action.
  • Dispatching Orchard shapes to arbitrary zones

    In my LIDNUG demo last week, I showed an interesting technique that I know some people will want to apply to their own stuff.

    The scenario is that you want the main content being displayed on the page to render parts of itself outside of the Content zone, typically in a sidebar zone.

    My own example was a Buy From Amazon part that displays a badge in the sidebar to enable readers to buy the book being reviewed.

  • Orchard Shape Wizardry

    While working on my employer's new website, we discovered that we had a need that didn't seem to fit into the Widget system for Orchard. Several places throughout our site, we need to be able to trigger the creation of a shape from a template, but have that shape populated with data through a controller of sorts. After a lengthy discussion with Bertrand Le Roy (who is ever so helpful), I stumbled upon the solution that we were looking for: IShapeTableProvider.

Software IP management and project development governance provided by Outercurve Foundation