debug.tpl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
  76. {if !empty($template_data)}
  77. <h2>included templates &amp; config files (load time in seconds)</h2>
  78. <div>
  79. {foreach $template_data as $template}
  80. <font color=brown>{$template.name}</font>
  81. <span class="exectime">
  82. (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
  83. </span>
  84. <br>
  85. {/foreach}
  86. </div>
  87. {/if}
  88. <h2>assigned template variables</h2>
  89. <table id="table_assigned_vars">
  90. {foreach $assigned_vars as $vars}
  91. <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
  92. <th>${$vars@key|escape:'html'}</th>
  93. <td>{$vars|debug_print_var nofilter}</td></tr>
  94. {/foreach}
  95. </table>
  96. <h2>assigned config file variables (outer template scope)</h2>
  97. <table id="table_config_vars">
  98. {foreach $config_vars as $vars}
  99. <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
  100. <th>{$vars@key|escape:'html'}</th>
  101. <td>{$vars|debug_print_var nofilter}</td></tr>
  102. {/foreach}
  103. </table>
  104. </body>
  105. </html>
  106. {/capture}
  107. <script type="text/javascript">
  108. {$id = $template_name|default:''|md5}
  109. _smarty_console = window.open("","console{$id}","width=680,height=600,resizable,scrollbars=yes");
  110. _smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
  111. _smarty_console.document.close();
  112. </script>