| 148 |
lars |
1 |
Debugging Console {#chapter.debugging.console}
|
|
|
2 |
=================
|
|
|
3 |
|
|
|
4 |
There is a debugging console included with Smarty. The console informs
|
|
|
5 |
you of all the [included](./language-builtin-functions/language-function-include.md) templates,
|
|
|
6 |
[assigned](../programmers/api-functions/api-assign.md) variables and
|
|
|
7 |
[config](./language-variables/language-config-variables.md) file variables for the current
|
|
|
8 |
invocation of the template. A template file named `debug.tpl` is
|
|
|
9 |
included with the distribution of Smarty which controls the formatting
|
|
|
10 |
of the console.
|
|
|
11 |
|
|
|
12 |
Set [`$debugging`](../programmers/api-variables/variable-debugging.md) to TRUE in Smarty, and if needed
|
|
|
13 |
set [`$debug_tpl`](../programmers/api-variables/variable-debug-template.md) to the template resource
|
|
|
14 |
path to `debug.tpl` (this is in [`SMARTY_DIR`](../programmers/smarty-constants.md) by
|
|
|
15 |
default). When you load the page, a Javascript console window will pop
|
|
|
16 |
up and give you the names of all the included templates and assigned
|
|
|
17 |
variables for the current page.
|
|
|
18 |
|
|
|
19 |
To see the available variables for a particular template, see the
|
|
|
20 |
[`{debug}`](./language-builtin-functions/language-function-debug.md) template function. To disable the
|
|
|
21 |
debugging console, set [`$debugging`](../programmers/api-variables/variable-debugging.md) to FALSE. You
|
|
|
22 |
can also temporarily turn on the debugging console by putting
|
|
|
23 |
`SMARTY_DEBUG` in the URL if you enable this option with
|
|
|
24 |
[`$debugging_ctrl`](../programmers/api-variables/variable-debugging-ctrl.md).
|
|
|
25 |
|
|
|
26 |
> **Note**
|
|
|
27 |
>
|
|
|
28 |
> The debugging console does not work when you use the
|
|
|
29 |
> [`fetch()`](../programmers/api-functions/api-fetch.md) API, only when using
|
|
|
30 |
> [`display()`](../programmers/api-functions/api-display.md). It is a set of javascript statements
|
|
|
31 |
> added to the very bottom of the generated template. If you do not like
|
|
|
32 |
> javascript, you can edit the `debug.tpl` template to format the output
|
|
|
33 |
> however you like. Debug data is not cached and `debug.tpl` info is not
|
|
|
34 |
> included in the output of the debug console.
|
|
|
35 |
|
|
|
36 |
> **Note**
|
|
|
37 |
>
|
|
|
38 |
> The load times of each template and config file are in seconds, or
|
|
|
39 |
> fractions thereof.
|
|
|
40 |
|
|
|
41 |
See also [troubleshooting](../appendixes/troubleshooting.md).
|