library/smarty/libs/debug.tpl
changeset 46 f11c31f7fa3e
parent 45 a56e7f9a0463
child 47 03388ec805b4
equal deleted inserted replaced
45:a56e7f9a0463 46:f11c31f7fa3e
     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, h3, 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 
       
    16             h1 {
       
    17                 margin: 0;
       
    18                 text-align: left;
       
    19                 padding: 2px;
       
    20                 background-color: #f0c040;
       
    21                 color: black;
       
    22                 font-weight: bold;
       
    23                 font-size: 1.2em;
       
    24             }
       
    25 
       
    26             h2 {
       
    27                 background-color: #9B410E;
       
    28                 color: white;
       
    29                 text-align: left;
       
    30                 font-weight: bold;
       
    31                 padding: 2px;
       
    32                 border-top: 1px solid black;
       
    33             }
       
    34 
       
    35             h3 {
       
    36                 text-align: left;
       
    37                 font-weight: bold;
       
    38                 color: black;
       
    39                 font-size: 0.7em;
       
    40                 padding: 2px;
       
    41             }
       
    42 
       
    43             body {
       
    44                 background: black;
       
    45             }
       
    46 
       
    47             p, table, div {
       
    48                 background: #f0ead8;
       
    49             }
       
    50 
       
    51             p {
       
    52                 margin: 0;
       
    53                 font-style: italic;
       
    54                 text-align: center;
       
    55             }
       
    56 
       
    57             table {
       
    58                 width: 100%;
       
    59             }
       
    60 
       
    61             th, td {
       
    62                 font-family: monospace;
       
    63                 vertical-align: top;
       
    64                 text-align: left;
       
    65             }
       
    66 
       
    67             td {
       
    68                 color: green;
       
    69             }
       
    70 
       
    71             .odd {
       
    72                 background-color: #eeeeee;
       
    73             }
       
    74 
       
    75             .even {
       
    76                 background-color: #fafafa;
       
    77             }
       
    78 
       
    79             .exectime {
       
    80                 font-size: 0.8em;
       
    81                 font-style: italic;
       
    82             }
       
    83 
       
    84             #bold div {
       
    85                 color: black;
       
    86                 font-weight: bold;
       
    87             }
       
    88 
       
    89             #blue h3 {
       
    90                 color: blue;
       
    91             }
       
    92 
       
    93             #normal div {
       
    94                 color: black;
       
    95                 font-weight: normal;
       
    96             }
       
    97 
       
    98             #table_assigned_vars th {
       
    99                 color: blue;
       
   100                 font-weight: bold;
       
   101             }
       
   102 
       
   103             #table_config_vars th {
       
   104                 color: maroon;
       
   105             }
       
   106 
       
   107             {/literal}
       
   108         </style>
       
   109     </head>
       
   110     <body>
       
   111 
       
   112     <h1>Smarty {Smarty::SMARTY_VERSION} Debug Console
       
   113         - {if isset($template_name)}{$template_name|debug_print_var nofilter} {/if}{if !empty($template_data)}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
       
   114 
       
   115     {if !empty($template_data)}
       
   116         <h2>included templates &amp; config files (load time in seconds)</h2>
       
   117         <div>
       
   118             {foreach $template_data as $template}
       
   119                 <font color=brown>{$template.name}</font>
       
   120                 <br>
       
   121                 &nbsp;&nbsp;
       
   122                 <span class="exectime">
       
   123                 (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}
       
   124                     ) (cache {$template['cache_time']|string_format:"%.5f"})
       
   125                  </span>
       
   126                 <br>
       
   127             {/foreach}
       
   128         </div>
       
   129     {/if}
       
   130 
       
   131     <h2>assigned template variables</h2>
       
   132 
       
   133     <table id="table_assigned_vars">
       
   134         {foreach $assigned_vars as $vars}
       
   135         <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
       
   136             <td><h3><font color=blue>${$vars@key}</font></h3>
       
   137                 {if isset($vars['nocache'])}<b>Nocache</b></br>{/if}
       
   138                 {if isset($vars['scope'])}<b>Origin:</b>{$vars['scope']|debug_print_var:10:80 nofilter}{/if}
       
   139             </td>
       
   140             <td><h3>Value</h3>{$vars['value']|debug_print_var:10:80 nofilter}</td>
       
   141             <td>{if isset($vars['attributes'])}<h3>Attributes</h3>{$vars['attributes']|debug_print_var nofilter} {/if}</td>
       
   142             {/foreach}
       
   143     </table>
       
   144 
       
   145     <h2>assigned config file variables</h2>
       
   146 
       
   147     <table id="table_config_vars">
       
   148         {foreach $config_vars as $vars}
       
   149             <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
       
   150                 <td><h3><font color=blue>#{$vars@key}#</font></h3>
       
   151                     {if isset($vars['scope'])}<b>Origin:</b>{$vars['scope']|debug_print_var:10:80 nofilter}{/if}
       
   152                 </td>
       
   153                 <td>{$vars['value']|debug_print_var:10:80 nofilter}</td>
       
   154             </tr>
       
   155         {/foreach}
       
   156 
       
   157     </table>
       
   158     </body>
       
   159     </html>
       
   160 {/capture}
       
   161 <script type="text/javascript">
       
   162     {$id = ''}
       
   163     {if $display_mode}{$id = "$offset$template_name"|md5}{/if}
       
   164     _smarty_console = window.open("", "console{$id}", "width=680,height=600,left={$offset},top={$offset},resizable,scrollbars=yes");
       
   165     _smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
       
   166     _smarty_console.document.close();
       
   167 </script>