orchardcmsorchardcms-1.9

Duplicate an orchard part


I'm trying to use Placement.info instead of overwriting a complete content template and i need to have a part (Parts_Title) displayed in the Content zone and in the Header zone. I was thinking that have two place with that Part in the Placement.info file would do the trick but it seems that the last one wins.

Is there a way to do that? I'm using Orchard 1.9.1.0

Edit 2016-03-16 following Alexander's answer:

There's something i should do wrong; i have a content type designed in the dashboard (no code) named OffreEmploi. I use Content-OffreEmploi.cshtml as the alternate. Here is the code:

@using Orchard.ContentManagement.Utilities;
@Display(Model.Header);
@Display(Model.Content);
@Display(Model.LocalZoneName);

and here is my placement.info

  <Match ContentType="OffreEmploi">    
    <Place Fields_DateTime-DateDebut="Header:2"/>
    <Place Fields_Common_Text-Duree="Header:3"/>
    <Place Fields_Common_Text-Localisation="Header:4"/>
    <Place Fields_Boolean-Temporaire="Header:5"/>
    <Place Fields_DateTime-DateExpiration="Header:6"/>
    <Place Parts_Common_Metadata="-"/>    
    <Place Fields_Common_Text-TexteIntroduction="Content:1"/>        
    <Place Parts_Title="Header:1" />
    <Place Parts_Common_Body="Content:3" />
    <Place Parts_Title="LocalZoneName:1" />
  </Match>

the part Parts_Title is rendered only at the end (in the LocalZoneName)


Solution

  • Placement.info allows you to specify a single place to put your part in. This is the reason behind the behavior you see - the last entry wins (LocalZoneName:1). And this is where your part's content now resides in - the LocalZoneName.

    What Alexander was actually suggesting, and what's the usual solution to this (not unusual) scenario is to use a separate, unique zone to put your part in, and render that zone multiple times, ie.:

    @using Orchard.ContentManagement.Utilities;
    @Display(Model.LocalZoneName);
    @Display(Model.Header);
    
    @Display(Model.LocalZoneName);
    @Display(Model.Content);
    

    This will make your LocalZoneName (which now containes the Title part) to be rendered twice - before the Header and Content zones.