01926 311880

How to put content in two zones at once

Gravatar Image by Carl Berisford-Murray
orchard logo

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. 

As an example, if you wanted to add a map image to each content item, you can add a text field to the item, and then specialise the field's view to:

WorkContext.Layout.Postcode = (string)Model.Value;

And then use it in Layout.cshtml like

<iframe id="map-to-shop" width="1280" height="500" frameborder="0" scrolling="no" 
marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=
@(WorkContext.Layout.Postcode.Replace(' ','')z=15&output=embed">

The other way is to have your driver output more than one shape, and put the additional shape in a different zone.

Add a Comment

Add a Comment