Placement: Trying to hide zones

Topics: Troubleshooting
Jul 6, 2011 at 11:22 PM

I've used the gist of the HelloWorld module to place a page into my site.  The .cshtml file itself is a wizard, and in the background is a complex model.  That works fine. (I must confess, I feel like I am working outside of Orchard with this, which almost defeats the purpose of using it, but alas I digress).

I'm using a Route.cs to insert this page.  And that works fine too.  Navigate to /SomePage and YAY!

However, the main site has some "default" content (layer, etc.).  I am happy to have the default footer zone content.  However, just as a test, I had default content for "AsideSecond" zone (an HTML Widget).

Now, when I navigate to my arbitrary page I see my default footer zone content (which is fine), but I also see the AsideSecond zone content, which is bad as it is just overlapping with the content of my /SomePage.

I have been wracking my brain with the Placement.info file, and cannot seem to figure this out. I got the idea to use "Zone_AsideSecond" from the Orchard docs, but that doesn't work.  I tried using <Match> attributes (Path="/SomePage"; ContentType="Page"; ContentType="Body", ContentType="Zone", etc.) but nothing works. I've tried a bunch of variations.

<Placement>

    <Match ContentType="Zone">       

<Place Zone_AsideSecond="-"/>   

    </Match>
</Placement>

Basically, I am trying to send that zone to nowhere.  I was testing it out because I expected to send everything to nowhere in this module's placement.info.  What am I doing wrong?

I tried using the Designer Tools but I cannot figure it out.  Most of what I find on here or the GooglePlex is Parts_..., for example I see Parts_Common_Body in the designer.  I know it's an HTML Widget, but even if that was it I cannot figure out how to word the <Place> attribute to handle that widget. And if I use "Parts_Common_Body" am I not only just dealing with content for that type only, what about everything else I create that I place in "default"?

I thought about creating a layer rule, but that doesn't seem right, primarily because I am going to have about 6 of these types of pages on the site, and it seems contrary to Orchard to do that.

Thanks in advance.

Coordinator
Jul 6, 2011 at 11:30 PM

Zones are not affected by placement. You can either use a different layout template for that path, or you can modify the rule for the default layer (or move your widgets to a layer with a different rule) to be not url("~/SomePage").

Jul 7, 2011 at 6:30 PM
Edited Jul 7, 2011 at 6:31 PM

Your blog, previously read but forgotten, http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx helped tremendously with this problem. The LayoutFilter.cs file was critical, and as the blog points out, it can be placed in the actual Module project. Thanks (again) for pointing me in the right direction.