Feb Veebruar
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Kuidas: Javascript Debug Mall

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: Lae alla pakett on saadaval siin: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Siin on muudetud kood, töö ja valmis minema ..

Here is the link where you can download the nanotree javascript… Siin on link, kus saab alla laadida 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. Asenda minu muutuja {$ Site.framework_pub} asjakohaselt nii, et JavaScript ja pilte saab asetatud.

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' Samuti pange tähele, ma olen lisatud lõik käsitseda kasutaja määratud silumise vars ... Minu silumise struktuuri nimega "_user_debug" ja "_user_debug_key"

For more info on how to implement this look at this thread : Täpsemat infot selle kohta, kuidas rakendada seda pilk seda teemat:
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. Vastasel juhul, kui sa ei ole huvitatud, et see on ohutu eemaldada, et osa mallist. You could also remove the {if} statement I used to wrap the template var section. Sa võid ka eemaldada {if} avalduse Ma kasutasin wrap malli var osa.

Another thing you might want to play with is how many characters are output as the value for debug. Teine asi, mida sa tahad mängida on, kui palju märke on väljundi väärtust siluda. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Vaata seda ja muuta teine ​​number muuta max tähemärki väljund: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kas keegi selgitada, miks ma saan ruumi üle <h3> õiges lahtris?

Hope this helps, I know I like it Loodan, et see aitab, ma tean, et see meeldib Naeratus

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 Et saada kõik javascript töötab korralikult pead ainult muutma rida "var mynanopath =" ja veenduge, et see on suunatud oma avaliku nanopath kataloog. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Võite alla nanotree pakett http://sourceforge.net/projects/nanotree/

Here is the updated code Siin on uuendatud kood

Code: Kood:
{* {*
Smarty Custom DHTML Debug Template Smarty Custom DHTML Debug Mall
@author Hielke Hoeve @ Author Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Author Owen Cole <owenc kell ideamesh dot com>
@since 02/13/2006 Smarty 2.6.12 @ Alates 2006/02/13 Smarty 2.6.12
@package Smarty @ Pakett Smarty
@filename debug.tpl @ Filename 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 = "Console_" + self.name;
{rdelim} {Rdelim}
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value "laius = 800, kõrgus 600, muudetava suurusega, kerimisribad = 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} polster: 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} laius: 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 ("<\ / div> \ 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 ("* Vajalik initsialiseerida puu. \ n");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Ja helistada showTree (ImagePath); tegelikult näitavad puu. \ 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 ("* Alternatiivina võib seda teha skripti ploki allosas lehekülge. \ n");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Kuigi see meetod on mõnevõrra puhtamaks. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("funktsioon init () {ldelim} \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("konteiner = 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 ("* Nimetatakse, kui kasutaja klikib sõlme. \ n");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param treeNode TreeNode objekt, mis on klõpsatud. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("funktsioon 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 ("funktsioon 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 \ / page16 × 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 *} {* Loo baasi node *}
{assign var=counter value=0} {Määrata var = counter = 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," See on Debug Tree. See asendab klassikalise versiooni Smarty Debug Console "); \ n");
{$counter++} {$ Counter + +}

{* Create node for template includes *} {* Loo sõlm mall sisaldab *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}," lisatud mallide ja config failid (laadimisaeg sekundites): ", pageIcon," ");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Lõik nimi = malle 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% on even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {lõik nimi = taane loop = $ _debug_tpls [malle]. sügavus} &&& {/ section} <font color = {if $ _debug_tpls [malle]. tüüp eq "template"} pruun {elseif $ _debug_tpls [malle]. tüüpi ekv 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 [malle]. exec_time)} <font size=-1> <i> ({$ _debug_tpls [malle]. exec_time | string_format: "% 0,5 f"}) {if% templates.index% eq 0} (kokku) {/ 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> ei malle lisada <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Osa}
_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 *} {* Loo sõlm kasutaja silumise muutujad *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}" kasutaja silumise muutujad: "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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for user debug variables *} {* Loo tütartippu kasutaja silumise muutujad *}
{section name=vars loop=$_user_debug} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _user_debug_key [vars]} {rdelim} "pageIcon" {$ _user_debug [vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei Kasutaja silumisinfot määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

{* Create node for template variables *} {* Loo sõlm malli muutujad *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}" määratud malli muutujad: "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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for template variables *} {* Loo tütartippu malli muutujad *}
{section name=vars loop=$_debug_keys} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _debug_keys [vars]} {rdelim} "pageIcon" {$ _debug_vals [vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei malli muutujad määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

{* Create node for smarty config file variables *} {* Loo sõlm smarty konfiguratsioonifaili muutujad *}
_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 sõlme {$ counter} = new TreeNode ({$ counter}," mis on määratud failis muutujad (välimine malli reguleerimisala): ", 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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for smarty config file variables *} {* Registreeru lapse sõlmpunktid smarty konfiguratsioonifaili muutujad *}
{section name=config_vars loop=$_debug_config_keys} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim} "pageIcon" {$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei config muutujad määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

_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 & User 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> Kliki muutujate puu, et nende sisu kuvatakse paremal paneelil. <\ / 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'> ja <\ / div> <\ / td>");
_smarty_console.document.write(”<td valign='top'><div id='debugtreetextdiv'>&<\/td>”); _smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> ja <\ / 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 postitatud juhendid , programmeerimine Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Järgige kommentaarid via RSS Feed | Jäta kommentaar | Trackback URL

Leave Your Comment Jäta oma kommentaar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - Kõik õigused reserveeritud - Ideamesh, Inc 22 päringut. 0.295 seconds. 0,295 sekundit.
Smarty Kuidas: Javascript Debug Malli | Ideamesh
 
 
Feb Veebruar
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty Kuidas: Javascript Debug Mall

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: Lae alla pakett on saadaval siin: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. Siin on muudetud kood, töö ja valmis minema ..

Here is the link where you can download the nanotree javascript… Siin on link, kus saab alla laadida 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. Asenda minu muutuja {$ Site.framework_pub} asjakohaselt nii, et JavaScript ja pilte saab asetatud.

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' Samuti pange tähele, ma olen lisatud lõik käsitseda kasutaja määratud silumise vars ... Minu silumise struktuuri nimega "_user_debug" ja "_user_debug_key"

For more info on how to implement this look at this thread : Täpsemat infot selle kohta, kuidas rakendada seda pilk seda teemat:
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. Vastasel juhul, kui sa ei ole huvitatud, et see on ohutu eemaldada, et osa mallist. You could also remove the {if} statement I used to wrap the template var section. Sa võid ka eemaldada {if} avalduse Ma kasutasin wrap malli var osa.

Another thing you might want to play with is how many characters are output as the value for debug. Teine asi, mida sa tahad mängida on, kui palju märke on väljundi väärtust siluda. Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 Vaata seda ja muuta teine ​​number muuta max tähemärki väljund: @ debug_print_var: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? PS Kas keegi selgitada, miks ma saan ruumi üle <h3> õiges lahtris?

Hope this helps, I know I like it Loodan, et see aitab, ma tean, et see meeldib Naeratus

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 Et saada kõik javascript töötab korralikult pead ainult muutma rida "var mynanopath =" ja veenduge, et see on suunatud oma avaliku nanopath kataloog. You can down the nanotree package from http://sourceforge.net/projects/nanotree/ Võite alla nanotree pakett http://sourceforge.net/projects/nanotree/

Here is the updated code Siin on uuendatud kood

Code: Kood:
{* {*
Smarty Custom DHTML Debug Template Smarty Custom DHTML Debug Mall
@author Hielke Hoeve @ Author Hielke Hoeve
@author Owen Cole <owenc at ideamesh dot com> @ Author Owen Cole <owenc kell ideamesh dot com>
@since 02/13/2006 Smarty 2.6.12 @ Alates 2006/02/13 Smarty 2.6.12
@package Smarty @ Pakett Smarty
@filename debug.tpl @ Filename 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 = "Console_" + self.name;
{rdelim} {Rdelim}
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value "laius = 800, kõrgus 600, muudetava suurusega, kerimisribad = 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} polster: 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} laius: 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 ("<\ / div> \ 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 ("* Vajalik initsialiseerida puu. \ n");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* Ja helistada showTree (ImagePath); tegelikult näitavad puu. \ 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 ("* Alternatiivina võib seda teha skripti ploki allosas lehekülge. \ n");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* Kuigi see meetod on mõnevõrra puhtamaks. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("funktsioon init () {ldelim} \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("konteiner = 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 ("* Nimetatakse, kui kasutaja klikib sõlme. \ n");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ param treeNode TreeNode objekt, mis on klõpsatud. \ n");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("funktsioon 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 ("funktsioon 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 \ / page16 × 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 *} {* Loo baasi node *}
{assign var=counter value=0} {Määrata var = counter = 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," See on Debug Tree. See asendab klassikalise versiooni Smarty Debug Console "); \ n");
{$counter++} {$ Counter + +}

{* Create node for template includes *} {* Loo sõlm mall sisaldab *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}," lisatud mallide ja config failid (laadimisaeg sekundites): ", pageIcon," ");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {Lõik nimi = malle 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% on even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {lõik nimi = taane loop = $ _debug_tpls [malle]. sügavus} &&& {/ section} <font color = {if $ _debug_tpls [malle]. tüüp eq "template"} pruun {elseif $ _debug_tpls [malle]. tüüpi ekv 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 [malle]. exec_time)} <font size=-1> <i> ({$ _debug_tpls [malle]. exec_time | string_format: "% 0,5 f"}) {if% templates.index% eq 0} (kokku) {/ 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> ei malle lisada <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/section} {/ Osa}
_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 *} {* Loo sõlm kasutaja silumise muutujad *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}" kasutaja silumise muutujad: "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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for user debug variables *} {* Loo tütartippu kasutaja silumise muutujad *}
{section name=vars loop=$_user_debug} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _user_debug_key [vars]} {rdelim} "pageIcon" {$ _user_debug [vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei Kasutaja silumisinfot määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

{* Create node for template variables *} {* Loo sõlm malli muutujad *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write ("var sõlme {$ counter} = new TreeNode ({$ counter}" määratud malli muutujad: "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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for template variables *} {* Loo tütartippu malli muutujad *}
{section name=vars loop=$_debug_keys} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _debug_keys [vars]} {rdelim} "pageIcon" {$ _debug_vals [vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei malli muutujad määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

{* Create node for smarty config file variables *} {* Loo sõlm smarty konfiguratsioonifaili muutujad *}
_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 sõlme {$ counter} = new TreeNode ({$ counter}," mis on määratud failis muutujad (välimine malli reguleerimisala): ", 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 vanem = node {$ counter} \ n");
{$counter++} {$ Counter + +}

{* Create child nodes for smarty config file variables *} {* Registreeru lapse sõlmpunktid smarty konfiguratsioonifaili muutujad *}
{section name=config_vars loop=$_debug_config_keys} {Lõik nimi = 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 sõlme {$ counter} = new TreeNode ({$ counter}" {ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim} "pageIcon" {$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | põgeneda: javascript | põgeneda: 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 sõlme {$ counter} = new TreeNode ({$ counter}" Ei config muutujad määratud "HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (node ​​{$ counter}) \ n");
{$counter++} {$ Counter + +}
{/section} {/ Osa}

_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 & User 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> Kliki muutujate puu, et nende sisu kuvatakse paremal paneelil. <\ / 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'> ja <\ / div> <\ / td>");
_smarty_console.document.write(”<td valign='top'><div id='debugtreetextdiv'>&<\/td>”); _smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> ja <\ / 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 postitatud juhendid , programmeerimine Owen

Follow comments via the RSS Feed | Leave a comment | Trackback URL Järgige kommentaarid via RSS Feed | Jäta kommentaar | Trackback URL

Leave Your Comment Jäta oma kommentaar

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - Kõik õigused reserveeritud - Ideamesh, Inc 22 päringut. 0.295 seconds. 0,295 sekundit.