Forums / Setup & design / Same content, different nodes, different layouts

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

eZ debug

Timing: Jan 18 2025 21:00:08
Script start
Timing: Jan 18 2025 21:00:08
Module start 'content'
Timing: Jan 18 2025 21:00:09
Module end 'content'
Timing: Jan 18 2025 21:00:09
Script end

Main resources:

Total runtime0.8330 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 587.8594180.8125
Module start 'content' 0.00800.6894 768.6719633.1484
Module end 'content' 0.69740.1355 1,401.8203341.0547
Script end 0.8329  1,742.8750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4837210.0002
Check MTime0.00140.1700210.0001
Mysql Total
Database connection0.00100.119210.0010
Mysqli_queries0.736588.41322050.0036
Looping result0.00220.25972030.0000
Template Total0.805596.720.4028
Template load0.00210.246620.0010
Template processing0.803596.455220.4017
Template load and register function0.00010.010610.0001
states
state_id_array0.00070.088010.0007
state_identifier_array0.00060.075120.0003
Override
Cache load0.00190.2271700.0000
Sytem overhead
Fetch class attribute can translate value0.00150.184440.0004
Fetch class attribute name0.00180.220180.0002
XML
Image XML parsing0.00130.152040.0003
class_abstraction
Instantiating content class attribute0.00000.0030110.0000
General
dbfile0.00720.8598330.0002
String conversion0.00000.001030.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
17content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs