debug.tpl 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. {* Smarty *}
  2. {* debug.tpl, last updated version 2.1.0 *}
  3. {assign_debug_info}
  4. {capture assign=debug_output}
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  7. <head>
  8. <title>Smarty Debug Console</title>
  9. {literal}
  10. <style type="text/css">
  11. /* <![CDATA[ */
  12. body, h1, h2, td, th, p {
  13. font-family: sans-serif;
  14. font-weight: normal;
  15. font-size: 0.9em;
  16. margin: 1px;
  17. padding: 0;
  18. }
  19. h1 {
  20. margin: 0;
  21. text-align: left;
  22. padding: 2px;
  23. background-color: #f0c040;
  24. color: black;
  25. font-weight: bold;
  26. font-size: 1.2em;
  27. }
  28. h2 {
  29. background-color: #9B410E;
  30. color: white;
  31. text-align: left;
  32. font-weight: bold;
  33. padding: 2px;
  34. border-top: 1px solid black;
  35. }
  36. body {
  37. background: black;
  38. }
  39. p, table, div {
  40. background: #f0ead8;
  41. }
  42. p {
  43. margin: 0;
  44. font-style: italic;
  45. text-align: center;
  46. }
  47. table {
  48. width: 100%;
  49. }
  50. th, td {
  51. font-family: monospace;
  52. vertical-align: top;
  53. text-align: left;
  54. width: 50%;
  55. }
  56. td {
  57. color: green;
  58. }
  59. .odd {
  60. background-color: #eeeeee;
  61. }
  62. .even {
  63. background-color: #fafafa;
  64. }
  65. .exectime {
  66. font-size: 0.8em;
  67. font-style: italic;
  68. }
  69. #table_assigned_vars th {
  70. color: blue;
  71. }
  72. #table_config_vars th {
  73. color: maroon;
  74. }
  75. /* ]]> */
  76. </style>
  77. {/literal}
  78. </head>
  79. <body>
  80. <h1>Smarty Debug Console</h1>
  81. <h2>included templates &amp; config files (load time in seconds)</h2>
  82. <div>
  83. {section name=templates loop=$_debug_tpls}
  84. {section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}
  85. <font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>
  86. {$_debug_tpls[templates].filename|escape:html}</font>
  87. {if isset($_debug_tpls[templates].exec_time)}
  88. <span class="exectime">
  89. ({$_debug_tpls[templates].exec_time|string_format:"%.5f"})
  90. {if %templates.index% eq 0}(total){/if}
  91. </span>
  92. {/if}
  93. <br />
  94. {sectionelse}
  95. <p>no templates included</p>
  96. {/section}
  97. </div>
  98. <h2>assigned template variables</h2>
  99. <table id="table_assigned_vars">
  100. {section name=vars loop=$_debug_keys}
  101. <tr class="{cycle values="odd,even"}">
  102. <th>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</th>
  103. <td>{$_debug_vals[vars]|@debug_print_var}</td></tr>
  104. {sectionelse}
  105. <tr><td><p>no template variables assigned</p></td></tr>
  106. {/section}
  107. </table>
  108. <h2>assigned config file variables (outer template scope)</h2>
  109. <table id="table_config_vars">
  110. {section name=config_vars loop=$_debug_config_keys}
  111. <tr class="{cycle values="odd,even"}">
  112. <th>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</th>
  113. <td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr>
  114. {sectionelse}
  115. <tr><td><p>no config vars assigned</p></td></tr>
  116. {/section}
  117. </table>
  118. </body>
  119. </html>
  120. {/capture}
  121. {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}
  122. {$debug_output}
  123. {else}
  124. <script type="text/javascript">
  125. // <![CDATA[
  126. if ( self.name == '' ) {ldelim}
  127. var title = 'Console';
  128. {rdelim}
  129. else {ldelim}
  130. var title = 'Console_' + self.name;
  131. {rdelim}
  132. _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
  133. _smarty_console.document.write('{$debug_output|escape:'javascript'}');
  134. _smarty_console.document.close();
  135. // ]]>
  136. </script>
  137. {/if}