Understanding placement.info file and alternates

Topics: Writing themes
Feb 16, 2012 at 7:11 AM

Hi Guys,

I'm new and stuck.

Not sure i quite understand placement and cant find good examples.

I have 2 recent blog lists so i want to place title after content on first and before content on the second one. My idea was to create two alternates and place them into placement.info.. something like this:

<Place Parts_RoutableTitle_Summary__81__url__homepage.cshtml="Content:After"></Place>
<Place Parts_RoutableTitle_Summary__90__url__homepage.cshtml="Content:Before"></Place>

apparently not working as i expected.

Can anyone try to explain me on the example above?


Feb 16, 2012 at 7:34 AM

Please read this: http://docs.orchardproject.net/Documentation/Understanding-placement-info

The first obvious problem here is that it deals with shapes, not alternate names, not template names , so no ".cshtml". Then, you should match on display type. And I don't think you can match on item id either.

Feb 16, 2012 at 8:41 AM
tnx for link, i red it before posting and didn helped.
Sorry, I made typo and made confusion. Anyway question have two parts:

<Match DisplayType="Summary">
    <Place Parts_RoutableTitle_Summary__81__url__homepage="Content:Before"/>
  <Match DisplayType="Summary">
    <Place Parts_RoutableTitle_Summary__90__url__homepage="Content:After"/>

All (not specific one) titles gets after ("after" overides "before").
Why i didn affect specific title and why i have overriding?


Feb 16, 2012 at 8:44 AM

I told you: you are trying to target an alternate instead of a shape. It just won't work. The scenario you're trying to implement is a little too complex for placement. You will need some code that alters the shape, in a handler, or shape table factory, to modify the display type for example. Only then you'll be able to use a match in placement to tell them apart.