Forums / Setup & design / Displaying used template name
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.
Wednesday 28 February 2007 4:33:38 am
Thanks to all, inline template debug will do the job!!!