Feb Februari
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Hur: Javascript Debug Template

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPPDATERING: En hämtade paketet finns här: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Här är den modifierade koden, arbeta och redo att gå ..

Here is the link where you can download the nanotree javascript… Här är länken där du kan hämta nanotree javascript ...
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. Ersätt min variabel {$ Site.framework_pub} lämpligt sätt så att javascript och bilder kan laddas korrekt.

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' Också behaga notera, har jag lagt till i en avsnitt för att hantera användarnas definierad debug Vars ... My debug struktur är uppkallad '_user_debug' och '_user_debug_key'

For more info on how to implement this look at this thread : För mer information om hur man genomför detta titt på denna tråd:
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. Annars om du inte är intresserad, är det säkert att ta bort den delen från mallen. You could also remove the {if} statement I used to wrap the template var section. Du kan också ta bort {if} uttalande jag brukade linda avsnittet mallen var.

Another thing you might want to play with is how many characters are output as the value for debug. En annan sak du kanske vill spela med är hur många tecken matas ut som värdet för debug. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Leta efter detta och ändra det andra numret att ändra Max tecken utgång: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kan någon räkna ut varför jag får ett utrymme ovanför <h3> i rätt cell?

Hope this helps, I know I like it Hoppas att detta hjälper, jag vet att jag gillar det Le

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 För att få all javascript fungerar korrekt behöver du bara ändra raden "var mynanopath =" och se till att den pekar till din offentliga nanopath katalogen. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Du kan ner den nanotree paket från http://sourceforge.net/projects/nanotree/

Here is the updated code Här är den uppdaterade koden

Code: Kod:
{* {*
Smarty Custom DHTML Debug Template Smarty Custom DHTML Debug mall
@author Hielke Hoeve @ Författare Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Författare Owen Cole <owenc vid ideamesh dot com>
@since 02/13/2006 Smarty 2.6.12 @ Sedan 2006/02/13 Smarty 2.6.12
@package Smarty @ Paketet Smarty
@filename debug.tpl @ Filnamn 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} annanstans {ldelim}
var title = 'Console_' + self.name; var title = 'Console_' + 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, skalbart, rullningslister = yes");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Smarty Debug Console_" + 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; marginal: 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: tunn solid svart, {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 ("* Behövs för att initiera trädet \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Och att kalla showTree (ImagePath). faktiskt visa trädet \ 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 ("* Alternativt kan detta göras i ett skript blocket längst ner på sidan \ n.");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Though denna metod är något renare \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("-funktionen 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 ("* Anropas när en användare klickar på en nod \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param treeNode den TreeNode objektet vilka har klickat \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("funktionen 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 ("funktionen 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 + "bilder \ / folder_closed.gif', \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + mynanopath + "bilder \ / folder_open.gif', \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + mynanopath + "bilder \ / sidan 16 × 16.gif'; \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var userIcon = '" + mynanopath + "bilder \ / 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 + "bilder \ / help_16 × 16.gif', \ n");

{* Create base node *} {* Skapa * base node}
{assign var=counter value=0} {Tilldela var = räknare värde = 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 = ny TreeNode ({$ räknare}, 'Smarty Debug', helpIcon," Detta är det Debug Tree Den ersätter den klassiska versionen av Smarty Felsökningskonsolen. '); \ n ");
{$counter++} {$ Räknare + +}

{* Create node for template includes *} {* Skapa nod för mall innehåller *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'inkluderade mallar & konfigurationsfiler (belastning tid i sekunder):', pageIcon, '");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Avsnitt name = mallar 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% är even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {avsnitt name = strecksatsen loop = $ _debug_tpls [mallar]. djup} &&& {/ avsnitt} <font color = {if $ _debug_tpls [mallar]. typ eq "mall"} brown {elseif $ _debug_tpls [mallar]. typ 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 [mallar] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [mallar] exec_time | string_format:. "% .5 f"}) {if% templates.index% eq 0} (totalt) {/ 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> inga mallar ingår <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Avsnitt}
_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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}

{* Create node for user debug variables *} {* Skapa nod för variabler användargrupper debug *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}," användarvänliga debug variabler: ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for user debug variables *} {* Skapa underordnade noder för variabler användargrupper debug *}
{section name=vars loop=$_user_debug} {Avsnitt 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{sectionelse} {Sectionelse}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'Ingen användare felsökningsinformation tilldelad', HelpIcon), \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

{* Create node for template variables *} {* Skapa nod för mall variabler *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}," tilldelade mallvariabler: ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for template variables *} {* Skapa underordnade noder för mallvariabler *}
{section name=vars loop=$_debug_keys} {Avsnitt namn = 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/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 nod {$ räknare} = ny TreeNode ({$ räknare}, 'Inga mallvariabler tilldelade", HelpIcon), \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

{* Create node for smarty config file variables *} {* Skapa nod för smarty variabler konfigurationsfil *}
_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 nod {$ räknare} = ny TreeNode ({$ räknare}," tilldelas config fil variabler (yttre mall omfattning): ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for smarty config file variables *} {* Skapa underordnade noder för smarty variabler konfigurationsfil *}
{section name=config_vars loop=$_debug_config_keys} {Avsnitt 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{sectionelse} {Sectionelse}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'Inga config variabler tilldelats", HelpIcon), \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

_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 & Användarhandbok Debug Console <\ / 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> Klicka på variabler i trädet för att få deras innehåll visas i den högra panelen <\ / 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 postat i Guider , Programmering av Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Följ kommentarer via RSS Feed | Lämna en kommentar | Trackback URL

Leave Your Comment Lämna din kommentar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - All Rights Reserved - Ideamesh, Inc. 22 frågor. 0.384 seconds. 0.384 sekunder.
Smarty Hur: Javascript Debug Template | Ideamesh
Feb Februari
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Hur: Javascript Debug Template

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPPDATERING: En hämtade paketet finns här: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Här är den modifierade koden, arbeta och redo att gå ..

Here is the link where you can download the nanotree javascript… Här är länken där du kan hämta nanotree javascript ...
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. Ersätt min variabel {$ Site.framework_pub} lämpligt sätt så att javascript och bilder kan laddas korrekt.

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' Också behaga notera, har jag lagt till i en avsnitt för att hantera användarnas definierad debug Vars ... My debug struktur är uppkallad '_user_debug' och '_user_debug_key'

For more info on how to implement this look at this thread : För mer information om hur man genomför detta titt på denna tråd:
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. Annars om du inte är intresserad, är det säkert att ta bort den delen från mallen. You could also remove the {if} statement I used to wrap the template var section. Du kan också ta bort {if} uttalande jag brukade linda avsnittet mallen var.

Another thing you might want to play with is how many characters are output as the value for debug. En annan sak du kanske vill spela med är hur många tecken matas ut som värdet för debug. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Leta efter detta och ändra det andra numret att ändra Max tecken utgång: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kan någon räkna ut varför jag får ett utrymme ovanför <h3> i rätt cell?

Hope this helps, I know I like it Hoppas att detta hjälper, jag vet att jag gillar det Le

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 För att få all javascript fungerar korrekt behöver du bara ändra raden "var mynanopath =" och se till att den pekar till din offentliga nanopath katalogen. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Du kan ner den nanotree paket från http://sourceforge.net/projects/nanotree/

Here is the updated code Här är den uppdaterade koden

Code: Kod:
{* {*
Smarty Custom DHTML Debug Template Smarty Custom DHTML Debug mall
@author Hielke Hoeve @ Författare Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Författare Owen Cole <owenc vid ideamesh dot com>
@since 02/13/2006 Smarty 2.6.12 @ Sedan 2006/02/13 Smarty 2.6.12
@package Smarty @ Paketet Smarty
@filename debug.tpl @ Filnamn 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} annanstans {ldelim}
var title = 'Console_' + self.name; var title = 'Console_' + 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, skalbart, rullningslister = yes");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Smarty Debug Console_" + 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; marginal: 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: tunn solid svart, {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 ("* Behövs för att initiera trädet \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Och att kalla showTree (ImagePath). faktiskt visa trädet \ 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 ("* Alternativt kan detta göras i ett skript blocket längst ner på sidan \ n.");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Though denna metod är något renare \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("-funktionen 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 ("* Anropas när en användare klickar på en nod \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param treeNode den TreeNode objektet vilka har klickat \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("funktionen 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 ("funktionen 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 + "bilder \ / folder_closed.gif', \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + mynanopath + "bilder \ / folder_open.gif', \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + mynanopath + "bilder \ / sidan 16 × 16.gif'; \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var userIcon = '" + mynanopath + "bilder \ / 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 + "bilder \ / help_16 × 16.gif', \ n");

{* Create base node *} {* Skapa * base node}
{assign var=counter value=0} {Tilldela var = räknare värde = 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 = ny TreeNode ({$ räknare}, 'Smarty Debug', helpIcon," Detta är det Debug Tree Den ersätter den klassiska versionen av Smarty Felsökningskonsolen. '); \ n ");
{$counter++} {$ Räknare + +}

{* Create node for template includes *} {* Skapa nod för mall innehåller *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'inkluderade mallar & konfigurationsfiler (belastning tid i sekunder):', pageIcon, '");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Avsnitt name = mallar 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% är even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {avsnitt name = strecksatsen loop = $ _debug_tpls [mallar]. djup} &&& {/ avsnitt} <font color = {if $ _debug_tpls [mallar]. typ eq "mall"} brown {elseif $ _debug_tpls [mallar]. typ 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 [mallar] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [mallar] exec_time | string_format:. "% .5 f"}) {if% templates.index% eq 0} (totalt) {/ 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> inga mallar ingår <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Avsnitt}
_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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}

{* Create node for user debug variables *} {* Skapa nod för variabler användargrupper debug *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}," användarvänliga debug variabler: ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for user debug variables *} {* Skapa underordnade noder för variabler användargrupper debug *}
{section name=vars loop=$_user_debug} {Avsnitt 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{sectionelse} {Sectionelse}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'Ingen användare felsökningsinformation tilldelad', HelpIcon), \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

{* Create node for template variables *} {* Skapa nod för mall variabler *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}," tilldelade mallvariabler: ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for template variables *} {* Skapa underordnade noder för mallvariabler *}
{section name=vars loop=$_debug_keys} {Avsnitt namn = 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/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 nod {$ räknare} = ny TreeNode ({$ räknare}, 'Inga mallvariabler tilldelade", HelpIcon), \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

{* Create node for smarty config file variables *} {* Skapa nod för smarty variabler konfigurationsfil *}
_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 nod {$ räknare} = ny TreeNode ({$ räknare}," tilldelas config fil variabler (yttre mall omfattning): ', new Array (closedGif, openGif)), \ n ");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (nod {$ räknare}); \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var förälder = nod {$ motverka}, \ n");
{$counter++} {$ Räknare + +}

{* Create child nodes for smarty config file variables *} {* Skapa underordnade noder för smarty variabler konfigurationsfil *}
{section name=config_vars loop=$_debug_config_keys} {Avsnitt 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 nod {$ räknare} = ny TreeNode ({$ räknare}, '{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 (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{sectionelse} {Sectionelse}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write ("var nod {$ räknare} = ny TreeNode ({$ räknare}, 'Inga config variabler tilldelats", HelpIcon), \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (nod {$ räknare}); \ n");
{$counter++} {$ Räknare + +}
{/section} {/ Avsnitt}

_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 & Användarhandbok Debug Console <\ / 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> Klicka på variabler i trädet för att få deras innehåll visas i den högra panelen <\ / 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 postat i Guider , Programmering av Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Följ kommentarer via RSS Feed | Lämna en kommentar | Trackback URL

Leave Your Comment Lämna din kommentar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - All Rights Reserved - Ideamesh, Inc. 22 frågor. 0.384 seconds. 0.384 sekunder.