Forums / Developer / How to Override modules pagelayout

How to Override modules pagelayout

Author Message

Pierre Tissot

Monday 30 July 2007 7:31:34 am

Hi,

I have a site that need to present the shop and advance search with a different looks (each one with their own layout) than the default pagelayout.

Since they are modules and not nodes or classes I don't know how to make it. I try two approaches:

- I try the layout/set/(mypage_layout) but all the futher links of this pagelayout built with ezurl are reflecting the /layout/set/(mypage_layout).

- I check the sections match criteria, but we cannot associate a section to a module, so I don't have idea of how I can use this.

Are they other strategies? because none of those ones are suitable for me?

Thanks

PiR

Bruce Morrison

Monday 30 July 2007 5:00:00 pm

Hi Pierre

I've had a look at the source for content/advancedsearch (kernel/content/advancedsearch.php) and it appears that you will only beable to override based on the section.

if ( $searchSectionID != -1 )
{
    include_once( 'kernel/common/eztemplatedesignresource.php' );
    $res =& eZTemplateDesignResource::instance();
    $res->setKeys( array( array( 'section', $searchSectionID ) ) );
}

It appears that $searchSectionID can be set in the search form. I'm unsure if this effects the actual search.

You can check out the shop module views looking for the "$res =& eZTemplateDesignResource::instance();" settings and see what keys are set. It is these that the override systems checks against the match conditions.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Thiago Campos Viana

Wednesday 01 August 2007 5:53:35 pm

working around you can write in the pagelayout.tpl:

{if $module_result.uri|contains("advancedsearch")}
<!-- code for the advanced search layout -->
{elseif $module_result.uri|contains("shop")}
<!-- code for the shop layout -->
{else}
<!-- code for the site layout -->
{/if}

eZ Publish Certified Developer: http://auth.ez.no/certification/verify/376924

Twitter: http://twitter.com/tcv_br