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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:20:07
Script start
Timing: Jan 18 2025 19:20:07
Module start 'layout'
Timing: Jan 18 2025 19:20:07
Module start 'content'
Timing: Jan 18 2025 19:20:08
Module end 'content'
Timing: Jan 18 2025 19:20:08
Script end

Main resources:

Total runtime0.7209 sec
Peak memory usage4,096.0000 KB
Database Queries59

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.0391152.6250
Module start 'layout' 0.00550.0030 741.664139.4609
Module start 'content' 0.00840.7109 781.1250585.9922
Module end 'content' 0.71940.0015 1,367.117212.1563
Script end 0.7209  1,379.2734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4171160.0002
Check MTime0.00130.1772160.0001
Mysql Total
Database connection0.00070.100810.0007
Mysqli_queries0.667092.5232590.0113
Looping result0.00060.0764570.0000
Template Total0.692796.120.3463
Template load0.00220.307820.0011
Template processing0.690495.769020.3452
Template load and register function0.00020.031410.0002
states
state_id_array0.00080.116210.0008
state_identifier_array0.00080.106820.0004
Override
Cache load0.00190.2590300.0001
Sytem overhead
Fetch class attribute can translate value0.00060.082830.0002
Fetch class attribute name0.00190.260550.0004
XML
Image XML parsing0.00110.150830.0004
class_abstraction
Instantiating content class attribute0.00000.001750.0000
General
dbfile0.00080.1121220.0000
String conversion0.00000.001440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 16
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs