Februar
13
2006

Smarty Kako: Javascript Debug Predloga

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

Tu je spremenjena koda, ki delajo in pripravljena iti ..

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

Zamenjati svoj spremenljivke} {$ Site.framework_pub primerno, da se lahko javascript in slike pravilno vstavljen.

Prav tako upoštevajte, da sem dodal v oddelku za ravnanje uporabnikov opredeljena vars odpravljanju napak ... Moj debug 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

V nasprotnem primeru, če vas ne zanima, da je varno odstraniti to poglavje iz predloge. Lahko bi tudi odstranite, če} {izjavo sem rabil, da zaviti del predloge var.

Druga stvar, ki jo morda želeli igrati s je, koliko znakov je izhod kot vrednost za debug. Bodite pozorni na to in spremeniti drugo številko spremeniti max izhod izpiši: @ 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 koda posodobljena

Koda:
{*
Smarty meri DHTML Debug Predloga
@ Avtor Hielke Hoeve
@ Avtor Owen Cole <owenc na ideamesh dot com>
@ Od 02/13/2006 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 title = "Console";
{Rdelim}
else {ldelim}
var title = "Console_ '+ self.name;
{Rdelim}
_smarty_console = window.open ("", title.value, "width = 800, height = 600, raztegljivo in 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} padding: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; ozadja-color: # CCCCCC; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable {ldelim} širina: 100%;} {rdelim \ n");
_smarty_console.document.write ("# debugtreetable td {ldelim} meja: thin solid black; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetextdiv div {ldelim} padding-left: 10px;} {rdelim \ 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 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 ("dragable = 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 za klic showTree (PotDoPodobe). da dejansko kažejo na drevo \ n");
_smarty_console.document.write ("* Druga možnost je to mogoče storiti v scenarij blok na dnu strani \ n.");
_smarty_console.document.write ("* Čeprav je ta metoda nekoliko čistejši \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funkcija init () {ldelim} \ n");
_smarty_console.document.write ("zabojnik = 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 ("* Called, ko uporabnik klikne na vozlišču \ n.");
_smarty_console.document.write ("* @ param treeNode predmet TreeNode, ki so kliknili \ 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" <\ / a> ", \ 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 "slike \ / folder_closed.gif', \ n");
_smarty_console.document.write ("var openGif = '" + + mynanopath "slike \ / folder_open.gif', \ n");
_smarty_console.document.write ("var pageIcon = '" + + mynanopath "slike \ / page16 × 16.gif", \ n ");
_smarty_console.document.write ("var userIcon = '" + + mynanopath "slike \ / user_16 × 16.gif", \ n ");
_smarty_console.document.write ("var helpIcon = '" + + mynanopath "slike \ / help_16 × 16.gif", \ n ");

{* Ustvari * osnovno vozlišče}
{Var = dodeli nasprotni vrednost = 0}
_smarty_console.document.write ("rootNode = new TreeNode ($ {števec}," Smarty Debug ", helpIcon," To je Debug Tree Nadomešča klasično različico Smarty konzolo Debug. '); \ n ");
{$ Števec + +}

{* Ustvari vozlišče za predloge vsebuje *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ($ {števec}," vključiti predloge poslovanja nastavitvene datoteke (obremenitev čas v sekundah): "pageIcon," ");
_smarty_console.document.write ("<br width=\"100%\">");
{Ime dela predloge = loop = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% je even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {odsek name = alinee loop = $ _debug_tpls [predlog]. globina} {&&& / del} <font color = {if dolarjev _debug_tpls [predlog]. vrsta eq "template"} {rjava elseif $ _debug_tpls [templates] vrsta eq. isset ($ _debug_tpls [templates] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [templates] exec_time | string_format:. "% 0,5 f"}) {if%% templates.index eq 0} (skupaj) {/ if} <\ \ / i> <\ \ / font> {/ if} <\ \ / tt> <\ \ / td> <\ \ / a> ");
{Sectionelse}
_smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> ni vključen predloge <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/ Del}
_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 uporabnikov odpravljanju napak *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ($ {števec} pomeni" spremenljivke razhroščevanje: "new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}), \ n");
_smarty_console.document.write ("var starši = vozlišče {$ števec}, \ n");
{$ Števec + +}

{* Ustvari otrok vozlišča za spremenljivke uporabnikov odpravljanju napak *}
{Ime odseka = VURS loop = $ _user_debug}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ($ {števec}" {ldelim} {$ $ _user_debug_key [VURS]}} {rdelim ", pageIcon, '{$ _user_debug [VURS] | @ 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 + +}
{/ Del}

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

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

{* Ustvari vozlišče za Smarty spremenljivk nastavitvene datoteke *}
_smarty_console.document.write ("var vozlišče {$ števec} = new TreeNode ($ {števec}," namenski konfiguracijski datoteki spremenljivke (zunanji obseg predloga): ", new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (vozlišče {$ števec}), \ n");
_smarty_console.document.write ("var starši = vozlišče {$ števec}, \ n");
{$ Števec + +}

{* Ustvari otrok vozlišča za Smarty spremenljivk nastavitvene datoteke *}
{Ime odseka = config_vars loop = $ _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}," No config spremenljivke, določene ", HelpIcon), \ n");
_smarty_console.document.write ("parent.addChild (vozlišče {$ števec}), \ n");
{$ Števec + +}
{/ Del}

_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 & Console Uporabnik Debug <\ / h3>");
_smarty_console.document.write ("<h4> Kliknite na spremenljivk v drevesu, da imajo njihove vsebine, prikazane na desni strani zaslona strani <\ / h4>.");
_smarty_console.document.write ("<br border='0' id='debugtreetable'> <tr>");
_smarty_console.document.write ("<td valign='top' style='width: 250px;'> <div id='debugtreediv'> & <\ / div> <\ / a>");
_smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / a>");
_smarty_console.document.write ("<\ / tr> <\ / a>");
_smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close ();
</ Script>

tags: ,
posted in vodniki , Programiranje s Owen

Spremljajte komentarje preko RSS Feed | Leave a comment | Trackback URL

Pusti svoj komentar

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