debug.tpl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {capture name='_smarty_debug' assign=debug_output}
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  4. <head>
  5. <title>Smarty Debug Console</title>
  6. <style type="text/css">
  7. {literal}
  8. body, h1, h2, td, th, p {
  9. font-family: sans-serif;
  10. font-weight: normal;
  11. font-size: 0.9em;
  12. margin: 1px;
  13. padding: 0;
  14. }
  15. h1 {
  16. margin: 0;
  17. text-align: left;
  18. padding: 2px;
  19. background-color: #f0c040;
  20. color: black;
  21. font-weight: bold;
  22. font-size: 1.2em;
  23. }
  24. h2 {
  25. background-color: #9B410E;
  26. color: white;
  27. text-align: left;
  28. font-weight: bold;
  29. padding: 2px;
  30. border-top: 1px solid black;
  31. }
  32. body {
  33. background: black;
  34. }
  35. p, table, div {
  36. background: #f0ead8;
  37. }
  38. p {
  39. margin: 0;
  40. font-style: italic;
  41. text-align: center;
  42. }
  43. table {
  44. width: 100%;
  45. }
  46. th, td {
  47. font-family: monospace;
  48. vertical-align: top;
  49. text-align: left;
  50. width: 50%;
  51. }
  52. td {
  53. color: green;
  54. }
  55. .odd {
  56. background-color: #eeeeee;
  57. }
  58. .even {
  59. background-color: #fafafa;
  60. }
  61. .exectime {
  62. font-size: 0.8em;
  63. font-style: italic;
  64. }
  65. #table_assigned_vars th {
  66. color: blue;
  67. }
  68. #table_config_vars th {
  69. color: maroon;
  70. }
  71. {/literal}
  72. </style>
  73. </head>
  74. <body>
  75. <h1>Smarty Debug Console
  76. - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
  77. {if !empty($template_data)}
  78. <h2>included templates &amp; config files (load time in seconds)</h2>
  79. <div>
  80. {foreach $template_data as $template}
  81. <font color=brown>{$template.name}</font>
  82. <span class="exectime">
  83. (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}
  84. )
  85. </span>
  86. <br>
  87. {/foreach}
  88. </div>
  89. {/if}
  90. <h2>assigned template variables</h2>
  91. <table id="table_assigned_vars">
  92. {foreach $assigned_vars as $vars}
  93. <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
  94. <th>${$vars@key|escape:'html'}</th>
  95. <td>{$vars|debug_print_var nofilter}</td>
  96. </tr>
  97. {/foreach}
  98. </table>
  99. <h2>assigned config file variables (outer template scope)</h2>
  100. <table id="table_config_vars">
  101. {foreach $config_vars as $vars}
  102. <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
  103. <th>{$vars@key|escape:'html'}</th>
  104. <td>{$vars|debug_print_var nofilter}</td>
  105. </tr>
  106. {/foreach}
  107. </table>
  108. </body>
  109. </html>
  110. {/capture}
  111. <script type="text/javascript">
  112. {$id = $template_name|default:''|md5}
  113. _smarty_console = window.open("", "console{$id}", "width=680,height=600,resizable,scrollbars=yes");
  114. _smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
  115. _smarty_console.document.close();
  116. </script>