Forums / Setup & design / Different pagelayout for root node full view and sitemap?

Different pagelayout for root node full view and sitemap?

Author Message

Chris McCulloh

Friday 28 January 2005 2:21:01 pm

I've come into an interesting scenario, and quite perhaps it's because I'm only a few months into eZ Publish (although insanely happy, best CMS I've worked with, by far).

Currently I have three different pagelayouts setup as follows in my site override:

[flash]
Source=pagelayout.tpl
MatchFile=flash.tpl
Subdir=templates
Match[node]=2

[districtmap]
Source=pagelayout.tpl
MatchFile=districtmap.tpl
Subdir=templates
Match[node]=300

[regular_pagelayout]
Source=pagelayout.tpl
MatchFile=regular_pagelayout.tpl
Subdir=templates

So basically, I have two different pagelayouts for nodes 300 and 2, and then a default for all of the other ones.

The problem is, I need to use the default pagelayout for the sitemap and when I access /content/view/sitemap (or the alias, either or), the layout for node 2 is used. Checking all the template variables, I've since come to realize that viewing the root node and the sitemap seem to be almost completely identical save for the uri ('/sitename' and '/content/view/sitemap') and the viewmode (root: 'full', sitemap: 'sitemap').

The problem is, from what I've dug up on the site, neither of these can be used to override the template that is used. All of the parameters you can use (e.g., node_id, object_id, parent_id, class, etc) have the same value when viewing either the root node or the sitemap! I assume this is because the sitemap is given the node_id that correlates to the node at which it is oriented to.

Any idea how I can force the sitemap module to use the default layout template, and not the one specifically intended for the full view of the root node? I could use a section show comparison at the start of a page to include the default template if it is a sitemap view, or include the root template if it's a full root view, but this doesn't seem terribly elegant..

Thanks

Balazs Halasy

Friday 28 January 2005 2:38:22 pm

Hi,

It is late and I'm not 100% clear in the head, but can't you just do something like "/layout/set/my_layoyt/content/view/sitemap"? Just thinking about the quickest way to solve your problem - definetively not so elegant, but might work... read this page:

http://www.ez.no/ez_publish/documentation/reference/modules/layout

Cheers!

Allman

Chris McCulloh

Friday 28 January 2005 8:57:49 pm

Thanks for the heads up -- I'm a bit embarassed I didn't find the layout module on my own. I suspected something like it existed, but... well, who knows.

It works, but it did necessitate some changes. Had to eliminate any references to ezurl and change them to ezroot to avoid the /layout/set/layoutname being prepended to every link (which is fine since the necessary VH changes had already been made), and add an entry for the default pagelayout to my layout.ini.append so that the layout module could find it.

Thanks!

Vlad Bailescu

Thursday 26 May 2005 8:30:15 am

Not being able to set a layout based on the view is one major pain in the a$$! Add to this the awkward solution to deal with multilanguage sites (using different siteaccesses for your site) and you will have a real mess, forcing you to kick in tons of |ezroot and a large number of overrides. This really sucks! Any advice from the developers?