Same content, different nodes, different layouts

Author Message

Nabil Alimi

Tuesday 08 November 2005 9:37:44 am

Hi,

Is it possible to set different override methods for a same node ?

I mean.

I have several articles. They are stored in a "articles folder" let's say node 7.

I have 2 pages :
- layout one
- layout two

To display articles on them, i fetches my article folder

fetch(content,list,hash(parent_node_id,7...))

And i display them using

 {node_view_gui content_node=$my_article view=line}

So this is the same template for the both pages.
But I have 2 <b>line_view_article.tpl</b>.
line_view_article_1.tpl for layout 1
line_view_article_2.tpl for layout 2

I thought it could be possible to specify that each line_view templates will be used for one specified node using the <b>Match[node]=...</b> but this refers to the node of the content that is called through the node_view_gui.
And I wanted it to refer to the node_id I am currently on.

Is it possible ?

(Wow pretty long post)

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Alexandre Abric

Wednesday 09 November 2005 12:52:25 am

What you did should work ... Is this a bug ?

Try creating the rule with the admin interface, and then edit it.

Gurudutt Verma

Wednesday 09 November 2005 1:28:00 am

Hi!

What is the criteria to distinguish node, I mean How will you decide when the node should use line_view_article_1.tpl or line_view_article_2.tpl

One temprerory solution of this is:
on the basis of your criteria try to use view=line and view=full or else and try to override these two templates.

Nabil Alimi

Wednesday 09 November 2005 2:03:21 am

Hi,

I wanted to use the Match[node] condition.

In my override.ini.append.php file it looked like this :

[line_article_1]
Source=node/view/line.tpl
Subdir=templates
MatchFile=test/line_article_1.tpl
Match[node]=60

[line_article_2]
Source=node/view/line.tpl
Subdir=templates
MatchFile=test/line_article_2.tpl
Match[node]=61

But the <b>Match[node]</b> condition seems to refer to the node of the object you want to display using the template, not the node you are currently on. :-/
Maybe i can add a switch statement in an unique line_article.tpl file. Case the current node is 60, i'll include line_article_node_60.tpl, line_article_node_59.tpl etc... But that's not a very clean way.
Or maybe i missed something.

Thanks to both of you for your help.

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

Gurudutt Verma

Wednesday 09 November 2005 2:26:27 am

Hi

if you have two different nodes and want to use two different template then your override.ini.append.php seems to be correct.

May be you are missing something else, but then this is the correct method of doing this. please reffer this for more help

http://ez.no/doc/ez_publish/technical_manual/3_6/templates/the_template_override_system/template_override_example

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_override_conditions

http://ez.no/products/ez_publish_cms/documentation/customization/custom_design/override_templates

I hope these links will help you.

All the best :-)

Nabil Alimi

Wednesday 09 November 2005 2:41:02 am

Yes I have 2 different templates but in fact that's what my main template look like :

{def $all_articles=fetch(content,list,hash(parent_node_id,2,class_filter_type,'include',class_filter_array,array('article')))}
{foreach $all_articles as $un_article}
{node_view_gui view=line content_node=$un_article}
{/foreach}

And just for testing purpose, my 2 line_article_#.tpl :

This is your intro :<br />
{attribute_view_gui attribute=$node.object.data_map.intro}

And the 2nd one.

{attribute_view_gui attribute=$node.object.data_map.intro}
That was your intro

It's the node_view_gui that seems problematic...

My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com
eZ Publish Freelance developper. Feel free to contact me +33 674 367 057
nabil at assiki d0t fr

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 16:17:45
Script start
Timing: Jan 18 2025 16:17:45
Module start 'layout'
Timing: Jan 18 2025 16:17:45
Module start 'content'
Timing: Jan 18 2025 16:17:45
Module end 'content'
Timing: Jan 18 2025 16:17:45
Script end

Main resources:

Total runtime0.0255 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.0469152.6406
Module start 'layout' 0.00570.0035 740.687539.4922
Module start 'content' 0.00920.0140 780.179797.4922
Module end 'content' 0.02320.0023 877.671942.3047
Script end 0.0255  919.9766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002811.0357140.0002
Check MTime0.00134.9062140.0001
Mysql Total
Database connection0.00083.215110.0008
Mysqli_queries0.002911.263530.0010
Looping result0.00000.055110.0000
Template Total0.00176.810.0017
Template load0.00093.482210.0009
Template processing0.00083.243110.0008
Override
Cache load0.00062.381210.0006
General
dbfile0.00052.138480.0001
String conversion0.00000.040240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs