smarty/debug.tpl
changeset 0 c63de9eb7045
equal deleted inserted replaced
-1:000000000000 0:c63de9eb7045
       
     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 
       
    20 h1 {
       
    21     margin: 0;
       
    22     text-align: left;
       
    23     padding: 2px;
       
    24     background-color: #f0c040;
       
    25     color:  black;
       
    26     font-weight: bold;
       
    27     font-size: 1.2em;
       
    28  }
       
    29 
       
    30 h2 {
       
    31     background-color: #9B410E;
       
    32     color: white;
       
    33     text-align: left;
       
    34     font-weight: bold;
       
    35     padding: 2px;
       
    36     border-top: 1px solid black;
       
    37 }
       
    38 
       
    39 body {
       
    40     background: black; 
       
    41 }
       
    42 
       
    43 p, table, div {
       
    44     background: #f0ead8;
       
    45 } 
       
    46 
       
    47 p {
       
    48     margin: 0;
       
    49     font-style: italic;
       
    50     text-align: center;
       
    51 }
       
    52 
       
    53 table {
       
    54     width: 100%;
       
    55 }
       
    56 
       
    57 th, td {
       
    58     font-family: monospace;
       
    59     vertical-align: top;
       
    60     text-align: left;
       
    61     width: 50%;
       
    62 }
       
    63 
       
    64 td {
       
    65     color: green;
       
    66 }
       
    67 
       
    68 .odd {
       
    69     background-color: #eeeeee;
       
    70 }
       
    71 
       
    72 .even {
       
    73     background-color: #fafafa;
       
    74 }
       
    75 
       
    76 .exectime {
       
    77     font-size: 0.8em;
       
    78     font-style: italic;
       
    79 }
       
    80 
       
    81 #table_assigned_vars th {
       
    82     color: blue;
       
    83 }
       
    84 
       
    85 #table_config_vars th {
       
    86     color: maroon;
       
    87 }
       
    88 /* ]]> */
       
    89 </style>
       
    90 {/literal}
       
    91 </head>
       
    92 <body>
       
    93 
       
    94 <h1>Smarty Debug Console</h1>
       
    95 
       
    96 <h2>included templates &amp; config files (load time in seconds)</h2>
       
    97 
       
    98 <div>
       
    99 {section name=templates loop=$_debug_tpls}
       
   100     {section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;{/section}
       
   101     <font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>
       
   102         {$_debug_tpls[templates].filename|escape:html}</font>
       
   103     {if isset($_debug_tpls[templates].exec_time)}
       
   104         <span class="exectime">
       
   105         ({$_debug_tpls[templates].exec_time|string_format:"%.5f"})
       
   106         {if %templates.index% eq 0}(total){/if}
       
   107         </span>
       
   108     {/if}
       
   109     <br />
       
   110 {sectionelse}
       
   111     <p>no templates included</p>
       
   112 {/section}
       
   113 </div>
       
   114 
       
   115 <h2>assigned template variables</h2>
       
   116 
       
   117 <table id="table_assigned_vars">
       
   118     {section name=vars loop=$_debug_keys}
       
   119         <tr class="{cycle values="odd,even"}">
       
   120             <th>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</th>
       
   121             <td>{$_debug_vals[vars]|@debug_print_var}</td></tr>
       
   122     {sectionelse}
       
   123         <tr><td><p>no template variables assigned</p></td></tr>
       
   124     {/section}
       
   125 </table>
       
   126 
       
   127 <h2>assigned config file variables (outer template scope)</h2>
       
   128 
       
   129 <table id="table_config_vars">
       
   130     {section name=config_vars loop=$_debug_config_keys}
       
   131         <tr class="{cycle values="odd,even"}">
       
   132             <th>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</th>
       
   133             <td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr>
       
   134     {sectionelse}
       
   135         <tr><td><p>no config vars assigned</p></td></tr>
       
   136     {/section}
       
   137 </table>
       
   138 </body>
       
   139 </html>
       
   140 {/capture}
       
   141 {if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}
       
   142     {$debug_output}
       
   143 {else}
       
   144 <script type="text/javascript">
       
   145 // <![CDATA[
       
   146     if ( self.name == '' ) {ldelim}
       
   147        var title = 'Console';
       
   148     {rdelim}
       
   149     else {ldelim}
       
   150        var title = 'Console_' + self.name;
       
   151     {rdelim}
       
   152     _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes");
       
   153     _smarty_console.document.write('{$debug_output|escape:'javascript'}');
       
   154     _smarty_console.document.close();
       
   155 // ]]>
       
   156 </script>
       
   157 {/if}