You are here: WikiStart/Docs/Developer/TemplateDumpers


Template Dumpers

Dumpers help you with debugging your application, as they display information about the loaded templates and assigned variables. patTemplate has been developed to help solve the webproblem and the output is most of the time displayed in the webbrowser. That's why we provide a dump that displays a nice (and interactive) HTML rendition of patTemplate's properties.

Writing a new Dump

If you are using patTemplate in a CLI environment or do not like the style of the Dump we provide, you may implement your own Dumper object. Just follow the following steps:

  1. Create a new file in patTemplate/Dump
  2. Create a new class in this file, that extends patTemplate_Dump
  3. Implement the needed methods: displayHeader(), displayFooter(), dumpGlobals() and dumpTemplates()

The methods displayHeader() and displayFooter() do not accept any parameters. The dumpGlobals() method will receive an array with all global template variables. The method dumpTemplates() will recieve two arrays, one with the template structures and content and one with the variables, that have been assigned.

Make use of print_r()

To get familiar with the structures passed to the Dump object, we recommend to use print_r() or var_dump() on the parameters.