Displaying used template name

Author Message

Ted Striker

Friday 16 February 2007 1:44:51 am

Hi,

I've been looking the forum for an answer, but did not find anything.

I want to output, let say, in a template called "view_article.tpl" the name of the template itself, that is:

Used template: view_article.tpl

Is there anywhere a variable (inside $node for example) holding this info?

Thats of course is for debug purposes, I have a very complex site, where many templates are included depending on the content and knowing in which template a bug is, can be a nightmare.

Thank you!!

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.

Nabil Alimi

Friday 16 February 2007 2:37:24 am

Hi Ted,

Could the inline template debug solve your problem as it displays the name of the template in HTML comments ?

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

André R.

Friday 16 February 2007 2:48:42 pm

My dev settings:

[ContentSettings]
ViewCaching=disabled

[TemplateSettings]
Debug=disabled
ShowXHTMLCode=disabled
ShowUsedTemplates=disabled
TemplateCache=disabled
TemplateCompile=disabled
TemplateOptimization=disabled
DevelopmentMode=enabled

[DebugSettings]
DebugOutput=enabled
DebugRedirection=disabled
DebugByIP=disabled
DebugToolbar=disabled

Just turn on Debug to locate witch template is being used and so.
Among a lot more info in the debug output it also inserts html comments witch makes Internet explorer run in quirks mode. Thats why I don't enable it by default.

NB! Remember to turn on Viewcache, Templatecache and TemplateCompile and test everything before going live, a lot of cache and templateCompiler related errors could be hiding from you..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Betsy Gamrat

Friday 16 February 2007 5:04:36 pm

Another method would be to adopt a simple coding standard, where you add an HTML comment into each template.

It will create overhead, but during development, it may be worth it.

For example: <!-- node/view/folder_full.tpl -->

You could use sed to swap the comments to be {* *} when you don't need the HTML anymore.

Ted Striker

Wednesday 28 February 2007 4:33:38 am

Thanks to all, inline template debug will do the job!!!

Can you feel it Mr. Anderson? Closing in on you? Oh I can, I really should thank you after all. It was, after all, it was your life that taught me the purpose of all life. Purpose of life is to end.

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

Main resources:

Total runtime0.0133 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.0041 588.1328151.2109
Module start 'layout' 0.00410.0018 739.343836.6484
Module start 'content' 0.00590.0060 775.992294.2656
Module end 'content' 0.01190.0014 870.257837.9922
Script end 0.0132  908.2500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002014.8199140.0001
Check MTime0.00097.0779140.0001
Mysql Total
Database connection0.00075.159010.0007
Mysqli_queries0.001813.446730.0006
Looping result0.00000.075410.0000
Template Total0.00107.610.0010
Template load0.00085.939810.0008
Template processing0.00021.635310.0002
Override
Cache load0.00053.870110.0005
General
dbfile0.001612.251280.0002
String conversion0.00000.037740.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