Februāris
13
2006

Smarty Kā jums: JavaScripts atkļūdošana Veidnes

UPDATE: lejupielādētā pakotne ir pieejama šeit: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Šeit ir modificēta kods, strādājot un gatavi iet ..

Šeit ir saite, kur jūs varat lejupielādēt nanotree javascript ...
http://nanotree.sourceforge.net/~~V

Aizstāt manu mainīgo {$ Site.framework_pub} atbilstoši tā ka JavaScript un attēli var būt ievietotas pareizi.

Arī lūdzu, ņemiet vērā, es esmu pievienojis sekcijā, parūpēties par lietotāju definēts atkļūdošanas Vars ... Mans atkļūdošanas struktūra ir nosaukta "_user_debug 'un' _user_debug_key"

Vairāk info par to, kā īstenot šo apskatīt šo pavedienu:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31.241

Pretējā gadījumā, ja Jums nav ieinteresēti, tā ir droša, lai izņemtu šo sadaļu no šablona. Jūs varētu arī noņemt {Ja} paziņojumu es mēdzu ietīt veidni VaR sadaļu.

Vēl viena lieta, jūs varētu vēlēties spēlēt ar ir, cik rakstzīmes ir izeja kā vērtību atkļūdošanas. Meklējiet šo un modificēt otro numuru mainīt max chars produkciju: @ debug_print_var: 0:1000

PS Vai kāds skaitlis, kāpēc es esmu kļūst atstarpi virs <h3> pareizajā šūnā?

Hope this helps, es zinu, man patīk Smaidīt

PS Lai saņemtu visas aktivizētam darbojas pareizi jums tikai nepieciešams mainīt līniju "var mynanopath =" un pārliecinieties, ka tas norāda uz jūsu publisko nanopath direktorijā. Jūs varat leju nanotree pakete no http://sourceforge.net/projects/nanotree/

Šeit ir atjaunināts kodu

Kods:
{*
Smarty Custom DHTML atkļūdošana Veidnes
@ Autors Hielke Hoeve
@ Autors Owen Kols <owenc pie ideamesh dot com>
@ Kopš 02/13/2006 Smarty 2.6.12
@ Pakete Smarty
@ Filename debug.tpl
*}

{Assign_debug_info}

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

ja (self.name == ") {ldelim}
var virsraksts = "konsole";
{Rdelim}
else {ldelim}
var title = "Console_" + self.name;
{Rdelim}
_smarty_console = window.open ("", title.value, "width = 800 augstums = 600, maināma izmēra, kas 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; background-color: # cccccc; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable {ldelim} platums: 100%; {rdelim} \ n");
_smarty_console.document.write ("# debugtreetable td {ldelim} robeža: plānas cietā melna; {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 ("* Nepieciešams, lai sāktu koku \ n".);
_smarty_console.document.write ("* Un zvanīt showTree panta imagePath);. faktiski parādītu koku \ n");
_smarty_console.document.write ("Pārmaiņus to var izdarīt ar skripta bloka lapas apakšā \ n".);
_smarty_console.document.write ("* Lai gan šī metode ir nedaudz tīrāks \ n".);
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("funkcija init () {ldelim} \ n");
_smarty_console.document.write ("konteineru = 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 ("* Sauc kad lietotājs noklikšķina uz mezglu \ n".);
_smarty_console.document.write ("* @ param treeNode TreeNode objekts, kas ir noklikšķinājuši \ 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 + "attēli \ / folder_closed.gif'; \ n");
_smarty_console.document.write ("var openGif =" "+ mynanopath +" attēli \ / folder_open.gif '; \ n ");
_smarty_console.document.write ("var pageIcon = '" + mynanopath + "attēli \ / page16 × 16.gif"; \ n ");
_smarty_console.document.write ("var userIcon = '" + mynanopath + "attēli \ / user_16 × 16.gif"; \ n ");
_smarty_console.document.write ("var helpIcon =" "+ mynanopath +" attēli \ / help_16 × 16.gif "; \ n");

{* Izveidojiet bāzes mezglā *}
{Piešķirt mainigais = skaitītājs vērtība = 0}
_smarty_console.document.write ("rootNode = jauns TreeNode ({$ skaitītājs}", Smarty Debug ", helpIcon," Tas ir Debug Tree Tas aizstāj klasisko versiju par Smarty Debug konsole. '); \ n ");
{$ Skaitītājs + +}

{* Izveidot mezglu, lai veidnei ietver *}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}," iekļauti veidnes un config failus (ielādes laiks s): ", pageIcon, '");
_smarty_console.document.write ("<table width=\"100%\">");
{Sadaļas nosaukums = veidnes cilpa = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% ir even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {sadaļa nosaukums = ievilkumā cilpa = $ _debug_tpls [veidnes]. dziļums} &&& {/ sadaļa} <font color = {ja $ _debug_tpls [veidnes]. tips eq "veidne",} brūns {elseif $ _debug_tpls [veidnes] tips eq. isset ($ _debug_tpls [veidnes] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [veidnes] exec_time | string_format:. "% 0,5 f",}) {ja% templates.index% eq 0} (kopā) {/ ja} <\ \ / i> <\ \ / font> {/ ja} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{Sectionelse}
_smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> neviena veidne iekļautas <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/ Sadaļa}
_smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write (""); \ n ");

_smarty_console.document.write ("rootNode.addChild (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}

{* Izveidot mezglu lietotāju Atkļūdošanas mainīgajiem *}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}" lietotājs debug mainīgie: "new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (mezglā {$ skaitītājs}); \ n");
_smarty_console.document.write ("var mātes = mezgls {$ skaitītāju}; \ n");
{$ Skaitītājs + +}

{* Izveidot bērnu mezglu lietotāju Atkļūdošanas mainīgajiem *}
{Sadaļas nosaukums = Vars cilpa = $ _user_debug}
_smarty_console.document.write ("var mezgla {$ counter} = jauns 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 ("parent.addChild (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}
{Sectionelse}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}", Nr Lietotāja Debug Informācija piešķirts ", HelpIcon) \ n");
_smarty_console.document.write ("parent.addChild (mezglā {$ counter}); \ n");
{$ Skaitītājs + +}
{/ Sadaļa}

{* Izveidot mezglu veidnes mainīgie *}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}," piešķirtie veidnes mainīgie: "new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (mezglā {$ skaitītājs}); \ n");
_smarty_console.document.write ("var mātes = mezgls {$ skaitītāju}; \ n");
{$ Skaitītājs + +}

{* Izveidot bērnu mezglu veidņu mainīgajiem *}
{Sadaļa name = Vars cilpa = $ _debug_keys}
{Ja $ _debug_keys [Vars] = "_user_debug Tieši && $ _debug_keys! [Vars]! =" _user_debug_key '}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}" {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 (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}
{/ Ja}
{Sectionelse}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauni TreeNode ({$ skaitītājs}" Nav veidņu mainīgajiem piešķirtie ", HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}
{/ Sadaļa}

{* Izveidot mezgls par Smarty config failu mainīgajiem *}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauni TreeNode ({$ skaitītājs}" piešķir config faila mainīgie (ārējais veidni joma): ", new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (mezglā {$ skaitītājs}); \ n");
_smarty_console.document.write ("var mātes = mezgls {$ skaitītāju}; \ n");
{$ Skaitītājs + +}

{* Izveidot bērnu mezglus par Smarty config failu mainīgajiem *}
{Sadaļas nosaukums = config_vars cilpa = $ _debug_config_keys}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}" {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 (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}
{Sectionelse}
_smarty_console.document.write ("var mezgla {$ skaitītājs} = jauns TreeNode ({$ skaitītājs}" nav config mainīgie piešķirtie ", HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (mezglā {$ skaitītājs}); \ n");
{$ Skaitītājs + +}
{/ Sadaļa}

_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 un Lietošanas Debug konsole <\ / h3>");
_smarty_console.document.write ("<h4> Noklikšķiniet uz mainīgo lielumu koku ir to saturu parādītas labajā pusē paneļa <\ / 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 ("<\ / tr> <\ / table>");
_smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close ();
</ SCRIPT>

tags: ,
rakstīja ceļveži , programmēšana ar Owen

Izpildiet komentāri caur RSS Feed | Leave a comment | Trackback URL

Pievienojiet komentāru

 
© 2008 - 2012 - All Rights Reserved - Ideamesh, Inc 22 vaicājumi. 2.391 sekundēm