Knowing if a node view template is overridden from a tpl

Author Message

Massimiliano Bariola

Thursday 12 April 2007 6:43:14 am

hi,

I want to add a breadcrumb navigation to my site and the standard code for them does a fine job of giving me links for each node in the hierarchy. the problem is that there are some nodes which are shown with the standard template that of course looks out of place and broken.

So what I need is some way to "know" within the pagelayout if the node I will print the name and URL to in the breadcrumb trail, will use its fallback full.tpl or a template I have customized.

e.g: the default output for the breadcrumb code goes like this:

MyRootNodeName > Categories > ShowAsFavorites > OnTheRoad > MyNiftyOnTheRoadArticle

of course the "ShowAsFavorites" is a folder by which the editor controls a certain behavior on the site by adding / removing objects there. That folder has no need to have a special visualization.

is there some operator combo or trick I can use from the template to know what tpl I will be using as "full" for a node?

thanks

Michael Lee

Thursday 12 April 2007 7:32:42 am

Hi Massimiliano,

You can add an attribute to specify the navigation status in your content class and set them to different values in content objects. The attribute type and meaning depends on your requirements.
For example, you can define a check box in content class to specify if it should be shown in navigation or not. You can also define a text-line attribute as the navigation link URL, and if the navigation link is empty, the default $node.url_alias will be used, otherwise, the specified URL will be used.

Does it answer your question?

Michael Lee | Managing Director | ZerusTech Ltd | www.zerustech.com

Skype: zerustech

Massimiliano Bariola

Monday 16 April 2007 2:48:26 am

hi Michael,

your solution surely will address the problem, but it involves some extra work from content editors and from programmers to enact it. I hoped to find a more structured and robust. solution that will ease the burden on the users.

Yours will surely work; but I don't want to change 30 content classes and manually set all those flags for all the content objects I have :) (currently 1000 and not easy to write rules to do that in a programmatical way - except for to check for which templates is the node using, which again puts me back to my original problem).

ciao and thank you again

M.

Massimiliano Bariola

Monday 23 April 2007 5:33:53 am

.... no one has any tip?

ciao

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

Main resources:

Total runtime0.7143 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 589.3047152.6563
Module start 'layout' 0.00820.0034 741.960939.4922
Module start 'content' 0.01160.7011 781.4531557.5313
Module end 'content' 0.71270.0015 1,338.984412.1094
Script end 0.7142  1,351.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.5524160.0002
Check MTime0.00140.1986160.0001
Mysql Total
Database connection0.00220.306210.0022
Mysqli_queries0.649690.9407600.0108
Looping result0.00060.0845580.0000
Template Total0.673494.320.3367
Template load0.00240.333220.0012
Template processing0.671093.946120.3355
Template load and register function0.00010.020010.0001
states
state_id_array0.00140.192210.0014
state_identifier_array0.00210.287320.0010
Override
Cache load0.00180.2589290.0001
Sytem overhead
Fetch class attribute can translate value0.00180.247020.0009
Fetch class attribute name0.00100.137060.0002
XML
Image XML parsing0.00110.160920.0006
class_abstraction
Instantiating content class attribute0.00000.002180.0000
General
dbfile0.00100.1377240.0000
String conversion0.00000.001240.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/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: 6

Time used to render debug report: 0.0003 secs