Frar
13
2006

Smarty Kif: Template debug Javascript

AĠĠORNAMENT: Pakkett dawnlowd hu disponibbli hawn: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Hawn hu l-kodiċi modifikat, mħaddma u lesta li tmur ..

Hawn hu l-link fejn tista 'tniżżel l-javascript nanotree ...
http://nanotree.sourceforge.net/~~V

Ibdel varjabbli tiegħi {$ Site.framework_pub} xieraq sabiex il-javascript u stampi jistgħu jiġu mgħobbija b'mod korrett.

Ukoll jekk jogħġbok innota, I miżjuda f'sezzjoni biex jimmaniġġaw vars debug utent definiti ... istruttura debug tiegħi huwa jismu '_user_debug "u" _user_debug_key "

Għal aktar tagħrif dwar kif se jimplimentaw dan ħarsa lejn dan il-ħajt:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Inkella jekk m'intix interessat, hu sikur biex jitneħħew dik is-sezzjoni mill-mudell. Inti tista 'wkoll ineħħi l-istqarrija {jekk} I użati biex wrap-taqsima var template.

Ħaġa oħra li inti tista 'tixtieq li jilagħbu ma hija kemm karattri huma l-produzzjoni bħala l-valur għall debug. Fittex għal dan u timmodifika l-tieni numru li jbiddel l-output Chars max: @ debug_print_var: 0:1000

PS Jista 'xi ħadd figura tispjega għaliex I am jkollna spazju fuq il-<h3> fiċ-ċellola dritt?

Nittama li dan jgħin, I know I bhalu Tbissem

PS Biex tikseb l-javascript jaħdmu sew inti biss ħtieġa li timmodifika l-linja "var mynanopath =" u kun żgur li jindika tiegħek direttorju nanopath pubbliku. Tista 'tistabbilixxi l-pakkett nanotree minn http://sourceforge.net/projects/nanotree/

Hawnhekk huwa l-kodiċi aġġornata

Kodiċi:
{*
Smarty debug Custom Template DHTML
@ Awtur Hielke Hoeve
@ Awtur Owen Cole <owenc fil ideamesh dot com>
@ Peress 2006/02/13 Smarty 2.6.12
@ Pakkett Smarty
@ File debug.tpl
*}

{Assign_debug_info}

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

jekk (self.name == ") {ldelim}
var title = "Console";
{Rdelim}
inkella {ldelim}
var title = "Console_" + self.name;
{Rdelim}
= window.open _smarty_console ("", title.value, "width = 800, tul = l 600, resizable, il scrollbars = iva");
_smarty_console.document.write ("Jekk jogħġbok Rata debug Smarty Console_" + self.name + "<\ / titolu> \ n");
_smarty_console.document.write ("<style> \ n");
_smarty_console.document.write ("H3 {ldelim} ikkuttunar: 5px 5px 5px 5px; marġni: 0px 0px 0px 0px; isfond bil-kulur: # cccccc; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable {ldelim} wisa ': 100%; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable td {ldelim} fruntiera: iswed solidu irqiq; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetextdiv div {ldelim} ikkuttunar-xellug: 10px; {rdelim} \ n");
_smarty_console.document.write ("<\ / style> \ n");
_smarty_console.document.write ("<script language=\"Javascript\" src=\"" + + mynanopath "nanotree.js\"> <\ / iskrittura> \ n");
_smarty_console.document.write ("<script type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write ("<- \ n!");
_smarty_console.document.write ("showRootNode = vera; \ n");
_smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write ("dragable = foloz; \ n");
_smarty_console.document.write ("showAllNodesOnStartup = vera; \ n");

_smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write ("* meħtieġa biex initialize-siġra \ n.");
_smarty_console.document.write ("* U li jsejħu showTree (imagePath);. li attwalment juru l-siġra \ n");
_smarty_console.document.write ("* Alternattivament dan jista 'jsir fi blokk iskrittura fil-qiegħ tal-paġna \ n.");
_smarty_console.document.write ("* Għalkemm dan il-metodu huwa kemmxejn aktar nodfa \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funzjoni Iniz () {ldelim} \ n");
_smarty_console.document.write ("kontenitur = 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 ("* Imsejħa meta utent klikks fuq node \ n.");
_smarty_console.document.write ("* @ param treeNode l-oġġett TreeNode li ġew għafast \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funzjoni 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 ("funzjoni nodeEdited (treeNode) {ldelim} \ n");
_smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write ("var closedGif =" "+ mynanopath +" immaġini \ / folder_closed.gif "; \ n");
_smarty_console.document.write ("var openGif =" "+ mynanopath +" immaġini \ / folder_open.gif "; \ n");
_smarty_console.document.write ("var pageIcon =" "+ mynanopath +" immaġini \ / page16 × 16.gif "; \ n");
_smarty_console.document.write ("var userIcon =" "+ mynanopath +" immaġini \ / user_16 × 16.gif "; \ n");
_smarty_console.document.write ("var helpIcon =" "+ mynanopath +" immaġini \ / help_16 × 16.gif "; \ n");

{* Oħloq * node bażi}
{Tassenja var = kontro-valur = 0}
_smarty_console.document.write ("rootNode = ġdid TreeNode ({$ kontro}," debug Smarty ", helpIcon," Dan huwa l-Siġra debug Huwa jissostitwixxi l-verżjoni klassika ta 'l-Console debug Smarty. "); \ n");
{$ Kontro + +}

{* Oħloq node għal mudell tinkludi *}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," inklużi mudelli u fajls konfigurazzjoni (ħin tat-tagħbija f'sekondi): ", pageIcon," ");
_smarty_console.document.write ("<table width=\"100%\">");
{Isem taqsima = mudelli linja = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% huwa even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> isem taqsima {= inċiż linja = $ _debug_tpls [templates]. fond} {&&& / sezzjoni} <font color = {jekk $ _debug_tpls [templates]. tip eq "template"} {kannella ElseIf $ _debug_tpls [templates]. tip eq isset ($ _debug_tpls [templates] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [templates] exec_time | string_format:. "% 0.5 f"}) {jekk% templates.index% eq 0} (total) {/ jekk} <\ \ / i> <\ \ / font> {/ jekk} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{Sectionelse}
_smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> ebda mudelli inklużi <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/ Sezzjoni}
_smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write (""); \ n ");

_smarty_console.document.write ("rootNode.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}

{* Oħloq node għal varjabbli debug utent *}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," varjabbli debug utent: ', Array ġodda (closedGif, openGif)); \ n ");
_smarty_console.document.write ("rootNode.addChild (node ​​{$ kontro}); \ n");
_smarty_console.document.write ("var = ġenitur node {$ kontro}; \ n");
{$ Kontro + +}

{* Oħloq lymph tfal għal varjabbli debug utent *}
{Isem taqsima = vars linja = $ _user_debug}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," {} $ {ldelim $ _user_debug_key [vars]} {rdelim} ", pageIcon," {$ _user_debug [vars] | @ debug_print_var: 0:1000 | ħarba: javascript | ħarba: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{Sectionelse}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," Le Informazzjoni debug Utent assenjat ", HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{/ Sezzjoni}

{* Oħloq node għal * varjabbli template}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," varjabbli template assenjati: ", Array ġodda (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (node ​​{$ kontro}); \ n");
_smarty_console.document.write ("var = ġenitur node {$ kontro}; \ n");
{$ Kontro + +}

{* Oħloq lymph tfal għal varjabbli template *}
{Isem taqsima = linja vars = $ _debug_keys}
{Jekk $ _debug_keys [vars]! = L && "_user_debug" $ _debug_keys [vars]! = "_user_debug_key"}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," {} $ {ldelim $ _debug_keys [vars]} {rdelim} ", pageIcon," {$ _debug_vals [vars] | @ debug_print_var: 0:1000 | ħarba: javascript | ħarba: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{/ Jekk}
{Sectionelse}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," Le varjabbli template assenjati ", HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{/ Sezzjoni}

{* Oħloq node għal varjabbli Smarty fajl konfigurazzjoni *}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," assenjat konfigurazzjoni varjabbli fajl (ambitu mudell ta 'barra): ", Array ġodda (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (node ​​{$ kontro}); \ n");
_smarty_console.document.write ("var = ġenitur node {$ kontro}; \ n");
{$ Kontro + +}

{* Oħloq lymph tfal għal varjabbli Smarty fajl konfigurazzjoni *}
{Isem taqsima = linja config_vars = $ _debug_config_keys}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," {} $ {ldelim $ _debug_config_keys [config_vars]} {rdelim} ", pageIcon," {$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | ħarba: javascript | ħarba: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{Sectionelse}
_smarty_console.document.write ("node var $ {kontro} = ġdid TreeNode ({$ kontro}," Le varjabbli konfigurazzjoni assenjati ", HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (node ​​{$ kontro}); \ n");
{$ Kontro + +}
{/ Sezzjoni}

_smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write ("<\ / iskrittura> \ n \ n");
_smarty_console.document.write ("<\ / ras> <body onload=\"init()\"> \ n");
_smarty_console.document.write ("<h3> Smarty & Console debug Utent <\ / H3>");
_smarty_console.document.write ("Ikklikkja <h4> fuq varjabbli fil-siġra li jkollhom kontenut tagħhom murija fil-pannell tal-lemin <\ / H4>.");
_smarty_console.document.write ("<table border='0' id='debugtreetable'> <tr>");
_smarty_console.document.write ("valign='top' <td style='width: 250px;'> <div id='debugtreediv'> & <\ / div> <\ / td>");
_smarty_console.document.write ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write ("<\ / ġisem> <\ / html>");
_smarty_console.document.close ();
</ SKRIPT>

tags: ,
stazzjonati fil Gwidi , Programmazzjoni mill Owen

Segwi l-kummenti permezz ta 'l -RSS Feed | Ħalli kumment | Trackback URL

Ħalli kumment tiegħek

 
© 2008 - 2012 - All Rights Reserved - Ideamesh, Inc 22 mistoqsijiet. 0.806 sekondi.