Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Template Toolkit - Output Template Name / Filepath as HTML Comment

by 1nickt (Canon)
on Jun 25, 2015 at 16:19 UTC ( [id://1131980]=note: print w/replies, xml ) Need Help??


in reply to Template Toolkit - Output Template Name / Filepath as HTML Comment

Replies are listed 'Best First'.
Re^2: Template Toolkit - Output Template Name / Filepath as HTML Comment
by cjoy (Initiate) on Jun 25, 2015 at 17:53 UTC

    Thanks for the FAQ link. I did not see that before.

    I am already aware that I can print the template name this way,
    what I try to learn is how I can have this happen at every invocation of any template / include
    _without_ having to add a print statement to each.

    In many web-centric templating systems there is a config setting to make this happen.
    I fail to find such a setting or a feasible workaround for TT.

      I hope I understand what you want ... just to avoid actually typing the tags? Because if they are going to be in the outputted HTML file, they are going to get printed somehow, by somebody :-)

      One thing to consider is that you can use TT2 to make TT2 templates ... So your default template for making an .html.tmpl could include the TT2 tags to display the debug info you want ...

      Or, if you make your templates by hand, since the text strings are going to be at the top and bottom of every template file you have, it doesn't seem necessary for TT2 to magically insert them. Instead, you could have the lines pre-inserted in the actual text files you create for templates, for example by using a macro in vim:

      # in ~/.vimrc " Set up templates for new files autocmd BufNewFile * 0r ~/.vim/templates/%:e.template

      and then

      # in ~/.vim/templates/tmpl.template <!-- Start output from [% component.name %] --> <!-- End output from [% component.name %] -->

      and then whenever you open a new file in vim it will have the tags pre-inserted.

      Hope this is close to the mark of what you needed!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1131980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 23:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found