Februar
13
2006

Smarty Kako: Predloga Javascript Debug

UPDATE: Paket prenos je na voljo tukaj: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Tukaj je spremenil kodo, ki delajo in pripravljena iti ..

Tukaj je link, kjer si lahko prenesete nanotree javascript ...
http://nanotree.sourceforge.net/

Zamenjaj mojo spremenljivko {$ Site.framework_pub} ustrezno, da se javascript in slike lahko pravilno naložen.

Upoštevajte tudi, da sem dodal na oddelku za ravnanje z uporabniško določene razhroščevalnih vars ... Moj razhroščevanje struktura se imenuje "_user_debug" in "_user_debug_key"

Za več informacij o tem, kako izvajati ta pogled na to temo:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Sicer pa, če vas ne zanima, da je varno odstraniti to poglavje iz predloge. Lahko tudi odstranite {če} izjavo sem rabil za zavijanje poglavje var predlogo.

Še ena stvar, ki jo morda želeli, da igrajo z, je, koliko znakov je izhod kot vrednost za debug. Bodite pozorni na to in spremenite številko drugega, da spremeni max ožge izhod: @ debug_print_var: 0:1000

PS Ali lahko kdorkoli ugotoviti, zakaj sem že prostor nad <h3> v pravo celico?

Upam, da to pomaga, vem, da mi je všeč Nasmeh

PS Da bi dobili vse, javascript deluje pravilno morate samo spremeniti vrstico "var mynanopath =" in se prepričajte, da kaže na vaš javni imenik nanopath. Lahko navzdol nanotree paket od http://sourceforge.net/projects/nanotree/

Tukaj je posodobljena koda

Koda:
{*
Smarty meri DHTML Predloga Debug
@ Avtor Hielke Hoeve
@ Avtor Owen Cole <owenc na ideamesh dot com>
@ Saj 2006/02/13 Smarty 2.6.12
@ Paket Smarty
@ Ime datoteke debug.tpl
*}

{Assign_debug_info}

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

if (self.name == ") {ldelim}
var naslov = "Console";
{Rdelim}
else {ldelim}
var naslov = "Console_ '+ self.name;
{Rdelim}
_smarty_console = window.open ("", title.value, "širina = 800, višina = 600, raztegljivo, scrollbars = yes");
_smarty_console.document.write ("<html> <head> <title> Smarty Debug Console_" + self.name + "<\ / title> \ n");
_smarty_console.document.write ("<style> \ n");
_smarty_console.document.write ("h3 {ldelim} oblazinjenje: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; background-color: # CCCCCC; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable {ldelim} širina: 100%; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable td {ldelim} meja: tanko črno barvo; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetextdiv div {ldelim} padding-left: 10px;} {rdelim \ 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 type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write ("<- \ n!");
_smarty_console.document.write ("showRootNode = true; \ n");
_smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write ("imamo premakljiv = false; \ n");
_smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write ("* potrebno za inicializacijo drevo \ n.");
_smarty_console.document.write ("* In poklicati showTree (PodDoPodobe). dejansko kažejo na drevo \ n");
_smarty_console.document.write ("* Alternativno se to lahko naredi na scenarij bloka na dnu strani \ n.");
_smarty_console.document.write ("* Čeprav je ta metoda nekoliko čistejša \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funkcija init () {ldelim} \ n");
_smarty_console.document.write ("posoda = document.getElementById (" debugtreediv '); \ n ");
_smarty_console.document.write ("showTree (" "+ mynanopath +" '); \ n ");
_smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write ("* klical, ko uporabnik klikne na vozlišču \ n.");
_smarty_console.document.write ("* @ param treeNode TreeNode predmet, ki so klikne \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funkcija standardClick (treeNode) {ldelim} \ n");
_smarty_console.document.write ("var mytext = document.getElementById (" debugtreetextdiv '); \ 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 ("{rdelim} \ n");

_smarty_console.document.write ("funkcija nodeEdited (treeNode) {ldelim} \ n");
_smarty_console.document.write ("{rdelim} \ 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 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 helpIcon = '" + + mynanopath "images \ / help_16 × 16.gif", \ n ");

{* Ustvarite osnovno vozlišče *}
{Dodeliti var = vrednost števca = 0}
_smarty_console.document.write ("rootNode = new TreeNode ({$ števec}, 'Smarty Odpravljanje napak", helpIcon,' To je Debug Tree Ta nadomešča klasično različico Smarty Debug konzolo. '); \ n ");
{$ Števec + +}

{* Ustvari vozlišče za predlogo vključuje *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}," vključeni Predloge & konfiguracijske datoteke (obremenitev čas v sekundah): "pageIcon," ");
_smarty_console.document.write ("<table width=\"100%\">");
{Ime oddelek = predloge zanka = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% je even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {ime oddelek = alinee loop = $ _debug_tpls [predloge]. globina} {&&& / section} <font color = {if $ _debug_tpls [predloge]. vrsta eq "Predloga"} {rjava elseif $ _debug_tpls [predloge]. vrsta eq isset ($ _debug_tpls [predloge] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [predloge] exec_time | string_format: ".% 0,5 f"}) {if% templates.index% eq 0} (skupno) {/ if} <\ \ / i> <\ \ / font> {/ if} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{Sectionelse}
_smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> nobenih predloge vključen <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/ Section}
_smarty_console.document.write ("<\ \ / a>");
_smarty_console.document.write ("'); \ n");

_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}

{* Ustvari vozlišče za spremenljivke, debug uporabnika *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}," spremenljivke razhroščevanju uporabnik: "new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}) \ n");
_smarty_console.document.write ("var nadrejeno vozlišče = {$ števec}, \ n");
{$ Števec + +}

{* Ustvari otrok vozlišča za spremenljivke, debug uporabnika *}
{Ime oddelek = vars zanka = $ _user_debug}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}, {ldelim} $ {$ _user_debug_key [vars]} {rdelim}", pageIcon, '{$ _user_debug [vars] | @ debug_print_var: 0:1000 | pobeg: javascript | pobeg: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{Sectionelse}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}" Ne Uporabnik Debug Informacije dodeljena ", HelpIcon), \ n");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{/ Section}

{* Ustvari vozlišče za predloge spremenljivk *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}," namenski predlogo spremenljivke: "new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}) \ n");
_smarty_console.document.write ("var nadrejeno vozlišče = {$ števec}, \ n");
{$ Števec + +}

{* Ustvari otrok vozlišča za predloge spremenljivk *}
{Ime oddelek = vars zanka = $ _debug_keys}
{If $ _debug_keys [vars]! = && '_user_debug' $ _debug_keys [Vars]! = '_user_debug_key'}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}, {ldelim} $ {$ _debug_keys [vars]} {rdelim}", pageIcon, '{$ _debug_vals [vars] | @ debug_print_var: 0:1000 | pobeg: javascript | pobeg: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{/ If}
{Sectionelse}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}, 'Ni predlogo spremenljivke dodeljene', HelpIcon), \ n");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{/ Section}

{* Ustvari vozlišče za Smarty spremenljivk datotek nastavitvenih *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}," namenski konfiguracijskih spremenljivk datotek (zunanji obseg predloga): ", new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}) \ n");
_smarty_console.document.write ("var nadrejeno vozlišče = {$ števec}, \ n");
{$ Števec + +}

{* Ustvari otrok vozlišča za Smarty spremenljivk datotek nastavitvenih *}
{Ime oddelek = config_vars zanka = $ _debug_config_keys}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}, {ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim}", pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | pobeg: javascript | pobeg: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{Sectionelse}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ({$ števec}, 'Ni konfiguracijskih spremenljivk dodeljene', HelpIcon), \ n");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}) \ n");
{$ Števec + +}
{/ Section}

_smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write ("<\ / script> \ n \ n");
_smarty_console.document.write ("<\ / head> <body onload=\"init()\"> \ n");
_smarty_console.document.write ("<h3> Smarty & Uporabniški Debug konzola <\ / h3>");
_smarty_console.document.write ("<h4> Kliknite na spremenljivk v drevesu, da imajo njihove vsebine, prikazane na desni strani plošče <\ / h4>.");
_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'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write ("<\ / a> <\ / a>");
_smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close ();
</ Script>

tags: ,
objavljen v vodnikih , Programiranje s Owen

Sledite komentarje preko RSS | Leave a comment | Trackback URL

Oddajte svoj komentar

© 2008 - 2013 - Vse pravice pridržane - Ideamesh, Inc 22 poizvedb. 0,303 sekunde.