Forums / Setup & design / custom pagelayout for search results

custom pagelayout for search results

Author Message

Patrice Fortin

Tuesday 13 March 2007 3:08:23 pm

Hi people,

I am working on a website with 3 sections, each having its own pagelayout. I use override.ini.append.php in my siteaccess to set which pagelayout to take depending on the section.

I also want to show search results (content/search) using the same pagelayout, depending from which section I did the search, but I didn't find an <i>easy</i> way for doing it.

I tried using an url_alias defined from admin interface, (firstsite_search pointing to content/search) but when I use this url to access the search page, I look in the code and url_alias is not set in array $matchKeys, function handleResource in file eztemplatedesignresource.php.

Also, the section (still in $matchKeys) is 7 (firstsite section) when checking overrides for the search.tpl template, but it is back to 1 when the checking overrides for pagelayout.tpl.

I managed to make it work by modifying the kernel, but I'm sure there is a cleaner way. I changed in search.php:

if ( $http->hasVariable( "SectionID" ) )
{
    $searchSectionID = $http->variable( "SectionID" );
}

to

if ( $http->hasVariable( "SectionID" ) )
{
    $searchSectionID = $http->variable( "SectionID" );
    $GLOBALS['eZDesignKeys']['section'] = $searchSectionID ;
}

And of course I added an hidden post variable in the search form in the 3 custom pagelayouts.

Does someone have a nice way to do what I did by modifying the kernel ?

Thanks
Patrice

Patrice Fortin

Thursday 15 March 2007 11:07:16 am

The way I did it is wrong, because I will have to modify too many things in order to make it work (advanced search page, user registration page, contact form confirmation, etc, etc). I cannot modify all these files.

The site I'm working on is built on ez 3.9.0. On a site using ez 3.6.3, I don't have this problem. I mean, when I go to a page without a section, it keeps the last pagelayout used (I suppose because the section id is kept).

There is a record in the bug tracker which talks about exactly this. I tought it was a feature, but the person which sent the bug report is of course calling it a bug. See here: http://issues.ez.no/IssueView.php?Id=7924&ProjectId=3

If it was a bug, it is not marked as solved but it is no longer occurring (at least for me in 3.9.0). If it is a feature, there is surely some config to enable to make it work in 3.9.0 as in 3.6.3.

Thanks
Patrice

Felix Woldt

Friday 16 March 2007 1:27:50 am

Hi Patrice,

i think their are two ways:

(1)
- create a dummy contentobject called search_node
- create an override template for this node
- use the template fetch function 'search' to get searchresult
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/search
( with ezhttp and the viewparemters you have access to all variables passed to this node)

(2)
- create a new extension called e.g. myspecialsearch
- copy the search.php from kernel and the module.php ...
- edit the search.php template and add the following to use another pagelayout

$Result['pagelayout'] = 'your_cutstom_pagelayout.tpl';

Felix

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Patrice Fortin

Friday 16 March 2007 7:04:09 am

Hi Felix,

thanks for your ideas. It would work if it was only for the search page. But as I said in the second post, I will have to do that kind of trick for every page not in a section. This means: search results, advanced search, kernel error pages, confirmation page after sending contact form, confirmation page of almost everything since it is out of every section.

What if I have a different siteaccess for every 'section' (which I would no longer call section) using the same database, having the same admin interface ?

Felix Woldt

Friday 16 March 2007 7:31:20 am

Hi Patrice,

You want to have for every section one pagelayout for all stuff like search, errors and so on.

Then i think a seperate siteaccess for every section will help. We have a lot of sites doing this. Their are no problems to have one admin for all 2 sites, but if you want to have special ini settings you need a seperate admin siteaccess for every section on the same database.

best regards
Felix Woldt

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Patrice Fortin

Friday 16 March 2007 12:28:03 pm

Thanks Felix!

I will have one siteaccess per section (my 3 sections), with the same design folder, but each with its own settings folder. I will create 3 pagelayouts with different names and I will modify override.ini in each siteaccess settings to get the right pagelayouts.

I will use a single admin interface.

Thank you very much.

eZ debug

Timing: Jan 18 2025 21:12:01
Script start
Timing: Jan 18 2025 21:12:01
Module start 'content'
Timing: Jan 18 2025 21:12:02
Module end 'content'
Timing: Jan 18 2025 21:12:02
Script end

Main resources:

Total runtime1.2402 sec
Peak memory usage4,096.0000 KB
Database Queries203

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.2578180.8281
Module start 'content' 0.00581.0603 770.0859589.5859
Module end 'content' 1.06610.1740 1,359.6719341.3828
Script end 1.2401  1,701.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3241210.0002
Check MTime0.00140.1108210.0001
Mysql Total
Database connection0.00080.062210.0008
Mysqli_queries1.143892.22642030.0056
Looping result0.00230.18272010.0000
Template Total1.203097.020.6015
Template load0.00180.149120.0009
Template processing1.201196.853220.6006
Template load and register function0.00010.011410.0001
states
state_id_array0.00210.168410.0021
state_identifier_array0.00150.124520.0008
Override
Cache load0.00260.2105550.0000
Sytem overhead
Fetch class attribute can translate value0.00180.145130.0006
Fetch class attribute name0.00130.105170.0002
XML
Image XML parsing0.00580.467530.0019
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00770.6196270.0003
String conversion0.00000.000330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs