Feb Februar
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Gewusst wie: Javascript Debug Template

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: Ein Download-Paket finden Sie hier: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Hier ist der Code geändert, arbeiten und bereit zu gehen ..

Here is the link where you can download the nanotree javascript… Hier ist der Link, wo Sie die nanotree Javascript herunterladen können ...
http://nanotree.sourceforge.net/ http://nanotree.sourceforge.net/

Replace my variable {$Site.framework_pub} appropriately so that the javascript and images can be loaded correctly. Ersetzen Sie meine Variable {$ Site.framework_pub} entsprechend, so dass die Javascript und Bilder richtig geladen werden kann.

Also please note, I have added in a section to handle user defined debug vars… My debug structure is named '_user_debug' and '_user_debug_key' Bitte beachten Sie auch, habe ich in einem Abschnitt hinzugefügt, um benutzerdefinierte Debug vars handhaben ... Meine Debug-Struktur namens '_user_debug' und '_user_debug_key'

For more info on how to implement this look at this thread : Für weitere Informationen darüber, wie Sie dieses Blick auf diesen Thread zu implementieren:
http://www.smarty.net/forums/viewtopic.php?p=31241#31241 http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Otherwise if you aren't interested, it is safe to remove that section from the template. Andernfalls, wenn Sie nicht interessiert sind, ist es sicher, diesen Abschnitt aus der Vorlage entfernen. You could also remove the {if} statement I used to wrap the template var section. Sie könnten auch entfernen {if} Anweisung habe ich die Vorlage var Abschnitt wickeln.

Another thing you might want to play with is how many characters are output as the value for debug. Eine andere Sache, die Sie mit spielen könnte, ist, wie viele Zeichen ausgegeben als Wert für debug. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Geben Sie für diese und ändern Sie die zweite Zahl die max Zeichen Ausgang ändern: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kann jemand herausfinden, warum ich immer einen Raum oberhalb des <h3> bin in der richtigen Zelle?

Hope this helps, I know I like it Hoffe, das hilft, weiß ich, Ich mag es Lächeln

PS To get all the javascript working correctly you only need to modify the line “var mynanopath = ” and make sure it points to your public nanopath directory. PS Um all das Javascript korrekt funktioniert müssen Sie lediglich die Zeile ändern "var mynanopath =" und stellen Sie sicher, es weist auf Ihren öffentlichen nanopath Verzeichnis. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Sie können sich das Paket von nanotree http://sourceforge.net/projects/nanotree/

Here is the updated code Hier ist die aktualisierte Code

Code: Code:
{* {*
Smarty Custom DHTML Debug Template Smarty Template Individuelle DHTML Debug
@author Hielke Hoeve @ Author Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Author Owen Cole <owenc bei ideamesh dot de>
@since 02/13/2006 Smarty 2.6.12 @ Since 02/13/2006 Smarty 2.6.12
@package Smarty @ Package Smarty
@filename debug.tpl @ Dateiname debug.tpl
*} *}

{assign_debug_info} {} Assign_debug_info

<SCRIPT language=javascript> <SCRIPT Language=javascript>
var mynanopath = “{$Site.javascript_path}\/nanotree\/”; var mynanopath = "{$ Site.javascript_path} \ / nanotree \ /";

if( self.name == ” ) {ldelim} if (self.name == ") {} ldelim
var title = 'Console'; var title = 'Console';
{rdelim} {} Rdelim
else {ldelim} else {} ldelim
var title = 'Console_' + self.name; var title = 'Konsole_' + self.name;
{rdelim} {} Rdelim
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value, "width = 800, height = 600, veränderbar, Scrollbalken = yes");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Smarty Debug Konsole_" + self.name + "<\ / title> \ n");
_smarty_console.document.write(”<style>\n”); _smarty_console.document.write ("<style> \ n");
_smarty_console.document.write(”h3 {ldelim}padding : 5px 5px 5px 5px; margin : 0px 0px 0px 0px; background-color : #cccccc;{rdelim}\n”); _smarty_console.document.write ("h3 {} ldelim padding: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; background-color: # cccccc; {rdelim} \ n");
_smarty_console.document.write(”#debugtreetable {ldelim}width : 100%;{rdelim} \n”); _smarty_console.document.write ("# debugtreetable {} ldelim width: 100%;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable td {ldelim}border : thin solid black;{rdelim} \n”); _smarty_console.document.write ("# debugtreetable td {} ldelim border: thin solid black;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetextdiv div {ldelim}padding-left : 10px;{rdelim} \n”); _smarty_console.document.write ("# debugtreetextdiv div {} ldelim padding-left: 10px;} {rdelim \ n");
_smarty_console.document.write(”<\/style>\n”); _smarty_console.document.write ("<\ / style> \ n");
_smarty_console.document.write(”<script language=\”Javascript\” src=\”" + mynanopath + “nanotree.js\”><\/script>\n”); _smarty_console.document.write ("<script language=\"Javascript\" src=\"" + + mynanopath "nanotree.js\"> <\ / script> \ n");
_smarty_console.document.write(”<script type=\”text\/javascript\” language=\”JavaScript\”>\n”); _smarty_console.document.write ("<script type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write(”<!–\n”); _smarty_console.document.write ("<- \ n");
_smarty_console.document.write(” showRootNode = true;\n”); _smarty_console.document.write ("showRootNode = true; \ n");
_smarty_console.document.write(” sortNodes = 0;\n”); _smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write(” dragable = false;\n”); _smarty_console.document.write ("dragable = false; \ n");
_smarty_console.document.write(” showAllNodesOnStartup = true;\n”); _smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Needed to initialize the tree.\n”); _smarty_console.document.write ("* benötigt, um den Baum zu initialisieren \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Und ShowTree (imagePath) nennen;. tatsächlich zeigen den Baum \ n");
_smarty_console.document.write(” * Alternatively this can be done in a script block at the bottom of the page.\n”); _smarty_console.document.write ("* Alternativ kann dies in einem Skript-Block an der Unterseite der Seite durchgeführt werden. \ n");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Obwohl diese Methode etwas sauberer ist. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("function init () {ldelim} \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("container = document.getElementById ('debugtreediv'); \ n");
_smarty_console.document.write(” showTree('” + mynanopath + “');\n”); _smarty_console.document.write ("ShowTree ('" + mynanopath + "'); \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Called when a user clicks on a node.\n”); _smarty_console.document.write ("* Wird aufgerufen, wenn ein Benutzer klickt auf einen Knoten \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param TreeNode das TreeNode-Objekt, das angeklickt haben. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("Funktion StandardClick (TreeNode) {ldelim} \ n");
_smarty_console.document.write(” var mytext = document.getElementById('debugtreetextdiv');\n”); _smarty_console.document.write ("var mytext = document.getElementById ('debugtreetextdiv'); \ n");
_smarty_console.document.write(” var param = treeNode.getParam();\n”); _smarty_console.document.write ("var param = treeNode.getParam (); \ n");
_smarty_console.document.write(” mytext.innerHTML = (param == ”) ? treeNode.getName() : '<h3>' + treeNode.getName() + '<\/h3><div>' + param + '<\/div>';\n”); _smarty_console.document.write ("mytext.innerHTML = (param ==") treeNode.getName ():? <h3> '+ treeNode.getName () +' <\ / h3> <div> '+ + param' <\ / div> '; \ n ");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” function nodeEdited(treeNode) {ldelim}\n”); _smarty_console.document.write ("Funktion nodeEdited (TreeNode) {ldelim} \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” var closedGif = '” + mynanopath + “images\/folder_closed.gif';\n”); _smarty_console.document.write ("var closedGif = '" + + mynanopath "images \ / folder_closed.gif'; \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + + mynanopath "images \ / folder_open.gif'; \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + + mynanopath "images \ / Seite16 × 16.gif'; \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var usericon = '" + + mynanopath "images \ / user_16 × 16.gif'; \ n");
_smarty_console.document.write(” var helpIcon = '” + mynanopath + “images\/help_16×16.gif';\n”); _smarty_console.document.write ("var HelpIcon = '" + + mynanopath "images \ / help_16 × 16.gif'; \ n");

{* Create base node *} {* Erstellen Basisknotens *}
{assign var=counter value=0} {Assign var = Zählerwert = 0}
_smarty_console.document.write(” rootNode = new TreeNode({$counter},'Smarty Debug', helpIcon, 'This is the Debug Tree. It replaces the classical version of the Smarty Debug Console');\n”); _smarty_console.document.write ("rootNode = new TreeNode ({$ counter}, 'Smarty Debug', HelpIcon, 'Dies ist die Debug Baum Es ersetzt die klassische Version der Smarty Debug-Konsole.'); \ n");
{$counter++} {$ Counter + +}

{* Create node for template includes *} {* Erstellen Knoten für Vorlage enthält *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'mitgelieferten Vorlagen & Konfigurationsdateien (Ladezeit in Sekunden):" pageIcon, "");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Section name = Vorlagen loop = $ _debug_tpls}
_smarty_console.document.write(”<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&&&{/section}<font color={if $_debug_tpls[templates].type eq “template”}brown{elseif $_debug_tpls[templates].type eq _smarty_console.document.write ("<tr bgcolor={if %templates.index% ist even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {section name = Gedankenstrich loop = $ _debug_tpls [Vorlagen]. Tiefe} &&& {/ section} <font color = {if $ _debug_tpls [Vorlagen]. type eq "template"} {elseif $ braun _debug_tpls [Vorlagen]. type eq isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:”%.5f”}){if %templates.index% eq 0} (total){/if}<\\/i><\\/font>{/if}<\\/tt><\\/td><\\/tr>”); isset ($ _debug_tpls [Vorlagen] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [Vorlagen] exec_time | string_format:. "% .5 f"}) {if% templates.index% eq 0} (gesamt) {/ if} <\ \ / i> <\ \ / font> {/ if} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{sectionelse} {} Sectionelse
_smarty_console.document.write(”<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included<\\/i><\\/tt><\\/td><\\/tr>”); _smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> keine Vorlagen enthalten <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Section}
_smarty_console.document.write(”<\\/table>”); _smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write(”');\n”); _smarty_console.document.write ("'); \ n");

_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}

{* Create node for user debug variables *} {* Erstellen Knoten für Benutzer Debug-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Benutzer Debug-Variablen:', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for user debug variables *} {* Erstellen Sie untergeordnete Knoten für Benutzer Debug-Variablen *}
{section name=vars loop=$_user_debug} {Section name = vars loop = $ _user_debug}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_user_debug_key[vars]}{rdelim}', pageIcon, '{$_user_debug[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _user_debug_key [vars]} {} rdelim', pageIcon, '{$ _user_debug [vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'No User Debug Informationen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

{* Create node for template variables *} {* Erstellen Knoten für Template-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Template-Variablen zugewiesen:', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for template variables *} {* Erstellen Sie untergeordnete Knoten für Template-Variablen *}
{section name=vars loop=$_debug_keys} {Section name = vars loop = $ _debug_keys}
{ if $_debug_keys[vars] != '_user_debug' && $_debug_keys[vars] != '_user_debug_key' } {If $ _debug_keys [vars]! = '_user_debug' && $ _debug_keys [Vars]! = '_user_debug_key'}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_keys[vars]}{rdelim}', pageIcon, '{$_debug_vals[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _debug_keys [vars]} {} rdelim', pageIcon, '{$ _debug_vals [vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/if} {/ If}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No template variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Keine Template-Variablen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

{* Create node for smarty config file variables *} {* Erstellen Knoten für smarty Konfigurations-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned config file variables (outer template scope):', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} 'zugewiesen Konfigurations-Variablen (äußere Vorlage scope):', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for smarty config file variables *} {* Erstellen Sie untergeordnete Knoten für smarty Konfigurations-Variablen *}
{section name=config_vars loop=$_debug_config_keys} {Section name = config_vars loop = $ _debug_config_keys}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_config_keys[config_vars]}{rdelim}', pageIcon, '{$_debug_config_vals[config_vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _debug_config_keys [config_vars]} {} rdelim', pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Keine config-Variablen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

_smarty_console.document.write(”\/\/–>\n”); _smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write(”<\/script>\n\n”); _smarty_console.document.write ("<\ / script> \ n \ n");
_smarty_console.document.write(”<\/head><body onload=\”init()\”>\n”); _smarty_console.document.write ("<\ / head> <body onload=\"init()\"> \ n");
_smarty_console.document.write(”<h3>Smarty & User Debug Console<\/h3>”); _smarty_console.document.write ("<h3> Smarty & Benutzer Debug-Konsole <\ / h3>");
_smarty_console.document.write(”<h4>Click on variables in the tree to have their contents displayed in the right side panel.<\/h4>”); _smarty_console.document.write ("<h4> Klicke auf Variablen in den Baum, um ihren Inhalt in der rechten Seitenwand angezeigt haben <\ / h4>.");
_smarty_console.document.write(”<table border='0′ id='debugtreetable'><tr>”); _smarty_console.document.write ("<table border='0' id='debugtreetable'> <tr>");
_smarty_console.document.write(”<td valign='top' style='width: 250px;'><div id='debugtreediv'>&<\/div><\/td>”); _smarty_console.document.write ("<td valign='top' style='width: 250px;'> <div id='debugtreediv'> & <\ / div> <\ / td>");
_smarty_console.document.write(”<td valign='top'><div id='debugtreetextdiv'>&<\/td>”); _smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write(”<\/tr><\/table>”); _smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write(”<\/body><\/html>”); _smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close(); _smarty_console.document.close ();
</SCRIPT> </ SCRIPT>

tags: , tags: ,
posted in Guides , Programming by Owen geschrieben in Guides , Programmierung von Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Folgen Sie Kommentare über den RSS Feed | Hinterlasse einen Kommentar | Trackback-URL

Leave Your Comment Lassen Sie Ihren Kommentar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - Alle Rechte vorbehalten - Ideamesh, Inc. 22 Abfragen. 0.271 seconds. 0,271 Sekunden.
Smarty Gewusst wie: Javascript Debug Template | Ideamesh
Feb Februar
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Gewusst wie: Javascript Debug Template

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: Ein Download-Paket finden Sie hier: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Hier ist der Code geändert, arbeiten und bereit zu gehen ..

Here is the link where you can download the nanotree javascript… Hier ist der Link, wo Sie die nanotree Javascript herunterladen können ...
http://nanotree.sourceforge.net/ http://nanotree.sourceforge.net/

Replace my variable {$Site.framework_pub} appropriately so that the javascript and images can be loaded correctly. Ersetzen Sie meine Variable {$ Site.framework_pub} entsprechend, so dass die Javascript und Bilder richtig geladen werden kann.

Also please note, I have added in a section to handle user defined debug vars… My debug structure is named '_user_debug' and '_user_debug_key' Bitte beachten Sie auch, habe ich in einem Abschnitt hinzugefügt, um benutzerdefinierte Debug vars handhaben ... Meine Debug-Struktur namens '_user_debug' und '_user_debug_key'

For more info on how to implement this look at this thread : Für weitere Informationen darüber, wie Sie dieses Blick auf diesen Thread zu implementieren:
http://www.smarty.net/forums/viewtopic.php?p=31241#31241 http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Otherwise if you aren't interested, it is safe to remove that section from the template. Andernfalls, wenn Sie nicht interessiert sind, ist es sicher, diesen Abschnitt aus der Vorlage entfernen. You could also remove the {if} statement I used to wrap the template var section. Sie könnten auch entfernen {if} Anweisung habe ich die Vorlage var Abschnitt wickeln.

Another thing you might want to play with is how many characters are output as the value for debug. Eine andere Sache, die Sie mit spielen könnte, ist, wie viele Zeichen ausgegeben als Wert für debug. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Geben Sie für diese und ändern Sie die zweite Zahl die max Zeichen Ausgang ändern: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kann jemand herausfinden, warum ich immer einen Raum oberhalb des <h3> bin in der richtigen Zelle?

Hope this helps, I know I like it Hoffe, das hilft, weiß ich, Ich mag es Lächeln

PS To get all the javascript working correctly you only need to modify the line “var mynanopath = ” and make sure it points to your public nanopath directory. PS Um all das Javascript korrekt funktioniert müssen Sie lediglich die Zeile ändern "var mynanopath =" und stellen Sie sicher, es weist auf Ihren öffentlichen nanopath Verzeichnis. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Sie können sich das Paket von nanotree http://sourceforge.net/projects/nanotree/

Here is the updated code Hier ist die aktualisierte Code

Code: Code:
{* {*
Smarty Custom DHTML Debug Template Smarty Template Individuelle DHTML Debug
@author Hielke Hoeve @ Author Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Author Owen Cole <owenc bei ideamesh dot de>
@since 02/13/2006 Smarty 2.6.12 @ Since 02/13/2006 Smarty 2.6.12
@package Smarty @ Package Smarty
@filename debug.tpl @ Dateiname debug.tpl
*} *}

{assign_debug_info} {} Assign_debug_info

<SCRIPT language=javascript> <SCRIPT Language=javascript>
var mynanopath = “{$Site.javascript_path}\/nanotree\/”; var mynanopath = "{$ Site.javascript_path} \ / nanotree \ /";

if( self.name == ” ) {ldelim} if (self.name == ") {} ldelim
var title = 'Console'; var title = 'Console';
{rdelim} {} Rdelim
else {ldelim} else {} ldelim
var title = 'Console_' + self.name; var title = 'Konsole_' + self.name;
{rdelim} {} Rdelim
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value, "width = 800, height = 600, veränderbar, Scrollbalken = yes");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Smarty Debug Konsole_" + self.name + "<\ / title> \ n");
_smarty_console.document.write(”<style>\n”); _smarty_console.document.write ("<style> \ n");
_smarty_console.document.write(”h3 {ldelim}padding : 5px 5px 5px 5px; margin : 0px 0px 0px 0px; background-color : #cccccc;{rdelim}\n”); _smarty_console.document.write ("h3 {} ldelim padding: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; background-color: # cccccc; {rdelim} \ n");
_smarty_console.document.write(”#debugtreetable {ldelim}width : 100%;{rdelim} \n”); _smarty_console.document.write ("# debugtreetable {} ldelim width: 100%;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable td {ldelim}border : thin solid black;{rdelim} \n”); _smarty_console.document.write ("# debugtreetable td {} ldelim border: thin solid black;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetextdiv div {ldelim}padding-left : 10px;{rdelim} \n”); _smarty_console.document.write ("# debugtreetextdiv div {} ldelim padding-left: 10px;} {rdelim \ n");
_smarty_console.document.write(”<\/style>\n”); _smarty_console.document.write ("<\ / style> \ n");
_smarty_console.document.write(”<script language=\”Javascript\” src=\”" + mynanopath + “nanotree.js\”><\/script>\n”); _smarty_console.document.write ("<script language=\"Javascript\" src=\"" + + mynanopath "nanotree.js\"> <\ / script> \ n");
_smarty_console.document.write(”<script type=\”text\/javascript\” language=\”JavaScript\”>\n”); _smarty_console.document.write ("<script type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write(”<!–\n”); _smarty_console.document.write ("<- \ n");
_smarty_console.document.write(” showRootNode = true;\n”); _smarty_console.document.write ("showRootNode = true; \ n");
_smarty_console.document.write(” sortNodes = 0;\n”); _smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write(” dragable = false;\n”); _smarty_console.document.write ("dragable = false; \ n");
_smarty_console.document.write(” showAllNodesOnStartup = true;\n”); _smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Needed to initialize the tree.\n”); _smarty_console.document.write ("* benötigt, um den Baum zu initialisieren \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Und ShowTree (imagePath) nennen;. tatsächlich zeigen den Baum \ n");
_smarty_console.document.write(” * Alternatively this can be done in a script block at the bottom of the page.\n”); _smarty_console.document.write ("* Alternativ kann dies in einem Skript-Block an der Unterseite der Seite durchgeführt werden. \ n");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Obwohl diese Methode etwas sauberer ist. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("function init () {ldelim} \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("container = document.getElementById ('debugtreediv'); \ n");
_smarty_console.document.write(” showTree('” + mynanopath + “');\n”); _smarty_console.document.write ("ShowTree ('" + mynanopath + "'); \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Called when a user clicks on a node.\n”); _smarty_console.document.write ("* Wird aufgerufen, wenn ein Benutzer klickt auf einen Knoten \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param TreeNode das TreeNode-Objekt, das angeklickt haben. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("Funktion StandardClick (TreeNode) {ldelim} \ n");
_smarty_console.document.write(” var mytext = document.getElementById('debugtreetextdiv');\n”); _smarty_console.document.write ("var mytext = document.getElementById ('debugtreetextdiv'); \ n");
_smarty_console.document.write(” var param = treeNode.getParam();\n”); _smarty_console.document.write ("var param = treeNode.getParam (); \ n");
_smarty_console.document.write(” mytext.innerHTML = (param == ”) ? treeNode.getName() : '<h3>' + treeNode.getName() + '<\/h3><div>' + param + '<\/div>';\n”); _smarty_console.document.write ("mytext.innerHTML = (param ==") treeNode.getName ():? <h3> '+ treeNode.getName () +' <\ / h3> <div> '+ + param' <\ / div> '; \ n ");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” function nodeEdited(treeNode) {ldelim}\n”); _smarty_console.document.write ("Funktion nodeEdited (TreeNode) {ldelim} \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write(” var closedGif = '” + mynanopath + “images\/folder_closed.gif';\n”); _smarty_console.document.write ("var closedGif = '" + + mynanopath "images \ / folder_closed.gif'; \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + + mynanopath "images \ / folder_open.gif'; \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + + mynanopath "images \ / Seite16 × 16.gif'; \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var usericon = '" + + mynanopath "images \ / user_16 × 16.gif'; \ n");
_smarty_console.document.write(” var helpIcon = '” + mynanopath + “images\/help_16×16.gif';\n”); _smarty_console.document.write ("var HelpIcon = '" + + mynanopath "images \ / help_16 × 16.gif'; \ n");

{* Create base node *} {* Erstellen Basisknotens *}
{assign var=counter value=0} {Assign var = Zählerwert = 0}
_smarty_console.document.write(” rootNode = new TreeNode({$counter},'Smarty Debug', helpIcon, 'This is the Debug Tree. It replaces the classical version of the Smarty Debug Console');\n”); _smarty_console.document.write ("rootNode = new TreeNode ({$ counter}, 'Smarty Debug', HelpIcon, 'Dies ist die Debug Baum Es ersetzt die klassische Version der Smarty Debug-Konsole.'); \ n");
{$counter++} {$ Counter + +}

{* Create node for template includes *} {* Erstellen Knoten für Vorlage enthält *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'mitgelieferten Vorlagen & Konfigurationsdateien (Ladezeit in Sekunden):" pageIcon, "");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Section name = Vorlagen loop = $ _debug_tpls}
_smarty_console.document.write(”<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&&&{/section}<font color={if $_debug_tpls[templates].type eq “template”}brown{elseif $_debug_tpls[templates].type eq _smarty_console.document.write ("<tr bgcolor={if %templates.index% ist even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {section name = Gedankenstrich loop = $ _debug_tpls [Vorlagen]. Tiefe} &&& {/ section} <font color = {if $ _debug_tpls [Vorlagen]. type eq "template"} {elseif $ braun _debug_tpls [Vorlagen]. type eq isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:”%.5f”}){if %templates.index% eq 0} (total){/if}<\\/i><\\/font>{/if}<\\/tt><\\/td><\\/tr>”); isset ($ _debug_tpls [Vorlagen] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [Vorlagen] exec_time | string_format:. "% .5 f"}) {if% templates.index% eq 0} (gesamt) {/ if} <\ \ / i> <\ \ / font> {/ if} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{sectionelse} {} Sectionelse
_smarty_console.document.write(”<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included<\\/i><\\/tt><\\/td><\\/tr>”); _smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> keine Vorlagen enthalten <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Section}
_smarty_console.document.write(”<\\/table>”); _smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write(”');\n”); _smarty_console.document.write ("'); \ n");

_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}

{* Create node for user debug variables *} {* Erstellen Knoten für Benutzer Debug-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Benutzer Debug-Variablen:', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for user debug variables *} {* Erstellen Sie untergeordnete Knoten für Benutzer Debug-Variablen *}
{section name=vars loop=$_user_debug} {Section name = vars loop = $ _user_debug}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_user_debug_key[vars]}{rdelim}', pageIcon, '{$_user_debug[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _user_debug_key [vars]} {} rdelim', pageIcon, '{$ _user_debug [vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'No User Debug Informationen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

{* Create node for template variables *} {* Erstellen Knoten für Template-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Template-Variablen zugewiesen:', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for template variables *} {* Erstellen Sie untergeordnete Knoten für Template-Variablen *}
{section name=vars loop=$_debug_keys} {Section name = vars loop = $ _debug_keys}
{ if $_debug_keys[vars] != '_user_debug' && $_debug_keys[vars] != '_user_debug_key' } {If $ _debug_keys [vars]! = '_user_debug' && $ _debug_keys [Vars]! = '_user_debug_key'}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_keys[vars]}{rdelim}', pageIcon, '{$_debug_vals[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _debug_keys [vars]} {} rdelim', pageIcon, '{$ _debug_vals [vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/if} {/ If}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No template variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Keine Template-Variablen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

{* Create node for smarty config file variables *} {* Erstellen Knoten für smarty Konfigurations-Variablen *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned config file variables (outer template scope):', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} 'zugewiesen Konfigurations-Variablen (äußere Vorlage scope):', new Array (closedGif, openGif)); \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (node ​​{$ counter}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var parent = Knoten {$ counter}; \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for smarty config file variables *} {* Erstellen Sie untergeordnete Knoten für smarty Konfigurations-Variablen *}
{section name=config_vars loop=$_debug_config_keys} {Section name = config_vars loop = $ _debug_config_keys}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_config_keys[config_vars]}{rdelim}', pageIcon, '{$_debug_config_vals[config_vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter} '{ldelim} $ {$ _debug_config_keys [config_vars]} {} rdelim', pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | escape: javascript | escape: javascript} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{sectionelse} {} Sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var Knoten {$ counter} = new TreeNode ({$ counter}, 'Keine config-Variablen zugewiesen', HelpIcon); \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}); \ n");
{$counter++} {$ Counter + +}
{/section} {/ Section}

_smarty_console.document.write(”\/\/–>\n”); _smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write(”<\/script>\n\n”); _smarty_console.document.write ("<\ / script> \ n \ n");
_smarty_console.document.write(”<\/head><body onload=\”init()\”>\n”); _smarty_console.document.write ("<\ / head> <body onload=\"init()\"> \ n");
_smarty_console.document.write(”<h3>Smarty & User Debug Console<\/h3>”); _smarty_console.document.write ("<h3> Smarty & Benutzer Debug-Konsole <\ / h3>");
_smarty_console.document.write(”<h4>Click on variables in the tree to have their contents displayed in the right side panel.<\/h4>”); _smarty_console.document.write ("<h4> Klicke auf Variablen in den Baum, um ihren Inhalt in der rechten Seitenwand angezeigt haben <\ / h4>.");
_smarty_console.document.write(”<table border='0′ id='debugtreetable'><tr>”); _smarty_console.document.write ("<table border='0' id='debugtreetable'> <tr>");
_smarty_console.document.write(”<td valign='top' style='width: 250px;'><div id='debugtreediv'>&<\/div><\/td>”); _smarty_console.document.write ("<td valign='top' style='width: 250px;'> <div id='debugtreediv'> & <\ / div> <\ / td>");
_smarty_console.document.write(”<td valign='top'><div id='debugtreetextdiv'>&<\/td>”); _smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write(”<\/tr><\/table>”); _smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write(”<\/body><\/html>”); _smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close(); _smarty_console.document.close ();
</SCRIPT> </ SCRIPT>

tags: , tags: ,
posted in Guides , Programming by Owen geschrieben in Guides , Programmierung von Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Folgen Sie Kommentare über den RSS Feed | Hinterlasse einen Kommentar | Trackback-URL

Leave Your Comment Lassen Sie Ihren Kommentar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - Alle Rechte vorbehalten - Ideamesh, Inc. 22 Abfragen. 0.271 seconds. 0,271 Sekunden.