How can I tell what DEFs are generating certain parts of my skin/template output?
In Foswiki 1.1+, the TRACE mode of
lib/Foswiki/Templates.pm adds HTML comments at the beginning and end of every
%TMPL:P% statement with the name of the DEF that was P'd. This can aid debugging skins/templates by giving you the name of the DEF which produced some output.
Warning: Do not enable Templates.pm TRACE mode on a live production site
Enabling TRACE mode in
lib/Foswiki/Templates.pm requires modification of that file. This feature should probably be made more accessible, however it is worth noting that enabling this feature
will break your site - it will produce invalid HTML (comments where there shouldn't be) and the output will look broken in the web browser.
So it is designed for annotating the raw HTML source.
Procedure
- Establish a parallel (non-public/production) version of your site
- Modify
lib/Foswiki/Templates.pm: Look for the line which reads use constant TRACE => 0; and change it to read use constant TRACE => 1; (near the top)
- If you are running persistent perl like
fastcgi or mod_perl: restart apache
- View the HTML output from the page of interest; there should be HTML comments annotating the output as described above.
--
PaulHarvey - 17 Dec 2010