Match not working in Placement.info?

Topics: Customizing Orchard, Troubleshooting, Writing themes
Mar 28, 2011 at 8:51 PM

On latest dev version, with a clean database install (Default recipe), I'm seeing the Body Summary appear underneath the Body itself on all content pages. So basically the first few paragraphs of the page are repeated at the bottom, which looks really confusing.

Shape Tracing attributes this placement to TheThemeMachine/Placement.info.

 

    <!-- show summary for all DisplayType by default -->
    <Place Parts_Common_Body_Summary="Content:5"/>

And then...

 

    <Match DisplayType="Detail">
        <!-- hide summary, show full content, for Detail -->
        <Place Parts_Common_Body_Summary="-"
               Parts_Common_Body="Content:5"
               Parts_Common_Metadata="Meta:2"/>
    </Match>

So, that override should be hiding the summary on Detail view, but it doesn't seem to be working.

It seems very similar to: http://orchard.codeplex.com/workitem/17320

 

 

Coordinator
Mar 28, 2011 at 9:45 PM

This is http://orchard.codeplex.com/workitem/17516

Mar 28, 2011 at 9:57 PM

What I'm starting to see is that in all cases, the *first* matching rule gets applied.

So it looks like there are two separate issues here;

1. Hyphens are working instead of double underscore for selecting e.g. FieldNames

2. Precedence of selection is top-down not bottom-up

Which also explains why in #17516 the first rule is getting applied even though the second rule would otherwise work.

Mar 29, 2011 at 12:18 AM

Ok ... when I initially replied I was getting mixed up with the thread on field name placement so what I wrote might have seemed a bit garbled :) I thought it was just another link to http://orchard.codeplex.com/workitem/17320.

But yes that #17516 is my error. I still think it's because the rules are somehow applying with reverse precedence. And actually I think that #17320 is showing the same sympton, the hyphened rule should be applying because that does currently work, but instead the first one is taking precedence.

Basically I discovered this when I was testing the double underscore for targetting specific fields. Double underscore seems to be acting effectively as a wildcard, so those rules affect all fields. So I tested with:

<Place Fields_Common_Text__FooBar1="Content:3"/>
<Place Fields_Common_Text__FooBar2="Content:4"/>

What happened here is that both fields were placed at Content:3. So I tried:

<Place Fields_Common_Text__FooBar1="Content:4"/>
<Place Fields_Common_Text__FooBar2="Content:3"/>

At this point both fields are placed at Content:4.

Finally,

<Place Fields_Common_Text-FooBar1="Content:3"/>
<Place Fields_Common_Text-FooBar2="Content:4"/>

Both fields placed at their correct positions.