פבואר
13
2006

החכם כיצד: תבנית Javascript Debug

UPDATE: חבילת ההורדה ניתן למצוא כאן: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

הנה קוד שונה, עבודה ומוכנה ללכת ..

הנה הקישור שבו אתה יכול להוריד JavaScript nanotree ...
http://nanotree.sourceforge.net/~~V

החלפת המשתנה שלי {$} Site.framework_pub כראוי כך JavaScript ותמונות ניתן לטעון כהלכה.

כמו כן שים לב, הוספתי בסעיף לטפל VARs באגים הגדרת משתמש ... המבנה debug שלי נקרא "_user_debug 'ו' _user_debug_key"

למידע נוסף על איך ליישם את זה להסתכל על נושא זה:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

אחרת אם אתה לא מעוניין, זה בטוח כדי להסיר את החלק מהתבנית. אתה יכול גם להסיר את ההצהרה {אם} השתמשתי לעטוף את החלק var התבנית.

דבר נוסף כדאי לשחק עם זה כמה תווים הם פלט כערך על באגים. חפשו את זה ולשנות את מספר 2 כדי לשנות את הפלט תווים לכל היותר: @ debug_print_var: 0:1000

נ.ב. מישהו יכול להבין למה אני מקבל שטח מעל <h3> בתא נכון?

מקווה שזה עוזר, אני יודע שאני אוהב את זה חיוך

נ.ב. כדי לקבל את כל javascript פועל כראוי אתה רק צריך לשנות את הקו "var mynanopath =" כדי לוודא שזה מצביע על המדריך nanopath הציבורי שלך. אתה יכול את החבילה nanotree מ http://sourceforge.net/projects/nanotree/

הנה קוד מעודכן

קוד:
{*
החכם מותאם אישית DHTML תבנית Debug
@ מחבר Hielke הובה
@ מחבר אוון קול <owenc ב ideamesh נקודה com>
@ מאז 2006/02/13 החכם 2.6.12
@ חבילת החכם
@ קובץ debug.tpl
*}

{Assign_debug_info}

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

אם (self.name == ") {ldelim}
var title = 'מסוף';
{Rdelim}
אחר {ldelim}
var title = "Console_ '+ self.name;
{Rdelim}
= window.open _smarty_console ("", title.value, "width = 800, height = 600, פסי גלילה, resizable = yes");
_smarty_console.document.write ("<html> <head> <title> Debug החכם Console_" + + self.name "<\ / title> \ n");
_smarty_console.document.write ("<style> \ n");
_smarty_console.document.write ("h3 {ldelim} ריפוד: 5px 5px 5px 5px, שולי: 0px 0px 0px 0px; צבע הרקע: # cccccc; {rdelim} \ n");
_smarty_console.document.write ("debugtreetable # {} ldelim רוחב: 100%;} {rdelim \ n");
_smarty_console.document.write ("debugtreetable # TD {} ldelim הגבול: שחור מוצק דק, {rdelim} \ n");
_smarty_console.document.write ("div # debugtreetextdiv {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 = נכון: \ n");
_smarty_console.document.write ("sortNodes = 0, \ n");
_smarty_console.document.write ("dragable = false; \ n");
_smarty_console.document.write ("showAllNodesOnStartup = נכון: \ n");

_smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write ("* דרושה כדי לאתחל את העץ. \ n");
_smarty_console.document.write ("* ולקרוא showTree (נתיב). ממש להראות את העץ \ n");
_smarty_console.document.write ("* לחילופין ניתן לעשות זאת בבלוק סקריפט בחלק התחתון של הדף. \ n");
_smarty_console.document.write ("* אף על פי שיטה זו הוא מנקה קצת. \ n");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("פונקציית init () {ldelim} \ n");
_smarty_console.document.write ("מיכל = 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 ("קראו * כאשר משתמש לוחץ על הצומת. \ n");
_smarty_console.document.write ("* @ param treeNode אובייקט TreeNode אשר היו לוחצים. \ n");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("פונקציה standardClick (treeNode) {ldelim} \ n");
_smarty_console.document.write ("var mytext = document.getElementById ('debugtreetextdiv'); \ n");
_smarty_console.document.write ("var פרמטר = treeNode.getParam (); \ n");
_smarty_console.document.write ("mytext.innerHTML = (פרמטר ==") treeNode.getName (): "<h3>" treeNode.getName + () + '<\ / h3> <div> "+ + פרמטר" <\ / p> '; \ n ");
_smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write ("פונקציה nodeEdited (treeNode) {ldelim} \ n");
_smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write ("var closedGif = '" + + mynanopath "תמונות \ / folder_closed.gif'; \ n");
_smarty_console.document.write ("var openGif = '" + + mynanopath "תמונות \ / folder_open.gif'; \ n");
_smarty_console.document.write ("var pageIcon = '" + + mynanopath "תמונות \ / page16 × 16.gif", \ n ");
_smarty_console.document.write ("var userIcon = '" + + mynanopath "תמונות \ / user_16 × 16.gif", \ n ");
_smarty_console.document.write ("var helpIcon = '" + + mynanopath "תמונות \ / help_16 × 16.gif", \ n ");

{* יצירת הצומת * בסיס}
{להקצות var = נגד הערך = 0}
_smarty_console.document.write ("rootNode = חדש TreeNode ($ {נגד}," Debug החכם ", helpIcon," זהו עץ Debug היא מחליפה את הגרסה הקלאסית של מסוף Debug החכם. ") \ n");
{$ Counter + +}

{* יצירת הצומת עבור התבנית כוללת *}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," כולל תבניות, קבצי תצורה (זמן הטעינה בשניות): ", pageIcon," ");
_smarty_console.document.write ("<table width=\"100%\">");
{סעיף name = תבניות לולאה = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% הוא even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {שם סעיף = כניסה לולאה = $ _debug_tpls [תבניות].} {&&& עומק / סעיף} <צבע הגופן = {אם $ _debug_tpls [תבניות]. סוג EQ "תבנית" חום} {elseif $ _debug_tpls [תבניות]. סוג EQ isset ($ _debug_tpls [תבניות] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [תבניות] exec_time | string_format:. "0.5% ו"}) {אם templates.index%% EQ 0} (סה"כ) {/ אם} <\ \ / i> <\ \ / font> {/ אם} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{Sectionelse}
_smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> אין תבניות כללה <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{/ סעיף}
_smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write (""); \ n ");

_smarty_console.document.write ("rootNode.addChild (צומת {$} counter); \ n");
{$ Counter + +}

{* יצירת הצומת עבור משתנים באגים משתמש *}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," ניפוי משתנים משתמש: ', מערך חדש (closedGif, openGif)); \ n ");
_smarty_console.document.write ("rootNode.addChild (צומת {$} counter); \ n");
_smarty_console.document.write ("var = הורה הצומת {$} הדלפק; \ n");
{$ Counter + +}

{* יצירת קשרי ילדים עבור משתנים באגים משתמש *}
{סעיף name = vars לולאה = $ _user_debug}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," {ldelim} {$ $ _user_debug_key [VARs]} {rdelim} ', pageIcon,' {$ _user_debug [VARs] | @ debug_print_var: 0:1000 | הבריחה javascript: | הבריחה javascript:} ") \ n");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{Sectionelse}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}, 'לא Debug פרטי המשתמש מוקצה", HelpIcon) \ n ");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{/ סעיף}

{* יצירת הצומת עבור * תבנית משתנים}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," משתנים שהוקצו תבנית: ", מערך חדש (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (צומת {$} counter); \ n");
_smarty_console.document.write ("var = הורה הצומת {$} הדלפק; \ n");
{$ Counter + +}

{* יצירת קשרי הילד משתנים התבנית *}
{סעיף name = vars לולאה = $ _debug_keys}
{אם $ _debug_keys [VARs]! = && של _user_debug '$ _debug_keys [VARs]! =' _user_debug_key "}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," {ldelim} {$ $ _debug_keys [VARs]} {rdelim} ', pageIcon,' {$ _debug_vals [VARs] | @ debug_print_var: 0:1000 | הבריחה javascript: | הבריחה javascript:} ") \ n");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{/ אם}
{Sectionelse}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," לא משתנים תבנית שהוקצו ", HelpIcon) \ n");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{/ סעיף}

{* יצירת הצומת עבור משתנים קבצים החכם תצורה *}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," מוקצה תצורה משתני הקובץ (היקף התבנית החיצונית): ", מערך חדש (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (צומת {$} counter); \ n");
_smarty_console.document.write ("var = הורה הצומת {$} הדלפק; \ n");
{$ Counter + +}

{* יצירת קשרי הילד משתנים קבצים החכם תצורה *}
{סעיף name = config_vars לולאה = $ _debug_config_keys}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," {ldelim} {$ $ _debug_config_keys [config_vars]} {rdelim} ', pageIcon,' {$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | הבריחה javascript: | הבריחה javascript:} ") \ n");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{Sectionelse}
_smarty_console.document.write ("צומת var {$} counter = חדש TreeNode ($ {נגד}," לא משתנים שהוקצו תצורה ", HelpIcon) \ n");
_smarty_console.document.write ("parent.addChild (צומת {$} counter); \ n");
{$ Counter + +}
{/ סעיף}

_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> החכם & Debug Console משתמש <\ / h3>");
_smarty_console.document.write ("לחץ <h4> על משתנים בעץ יש תוכנם המוצגים בלוח הימני <\ / h4>.");
_smarty_console.document.write ("<table border='0' id='debugtreetable'> <tr>");
_smarty_console.document.write ("valign='top' <td style='width: 250px;'> <div id='debugtreediv'> & <\ / p> <\ / 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>

תגים: ,
פירסם מדריכים , תכנות על ידי אוון

עקוב אחר תגובות באמצעות RSS Feed | השאירו תגובה | Trackback URL

השאירו תגובה שלך

 
© 2008 - 2012 - כל הזכויות שמורות - Ideamesh, Inc 22 שאילתות. 0.929 שניות.