Φεβρουάριος
13
2006

Πώς να Ξεφτέρη: Debug Javascript Πρότυπο

UPDATE: Ένα πακέτο λήψης είναι διαθέσιμο εδώ: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Εδώ είναι ο τροποποιημένος κώδικας, που εργάζονται και είναι έτοιμος να πάει ..

Εδώ είναι ο σύνδεσμος όπου μπορείτε να κατεβάσετε το nanotree javascript ...
http://nanotree.sourceforge.net/~~V

Αντικαταστήστε μεταβλητή μου {} $ Site.framework_pub κατάλληλα, έτσι ώστε η javascript και οι εικόνες μπορούν να φορτωθούν σωστά.

Επίσης παρακαλώ σημειώστε, έχω προσθέσει ένα τμήμα για να χειριστεί οριστεί από το χρήστη ... Vars debug δομή debug μου ονομάζεται «_user_debug» και «_user_debug_key»

Για περισσότερες πληροφορίες σχετικά με το πώς να εφαρμόσουν αυτό το βλέμμα σε αυτό το νήμα:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Διαφορετικά, αν δεν σας ενδιαφέρει, είναι ασφαλές να καταργήσετε αυτό το τμήμα από το πρότυπο. Θα μπορούσατε επίσης να αφαιρέσετε το {αν} δήλωση θα χρησιμοποιηθούν για να τυλίξετε το τμήμα var πρότυπο.

Ένα άλλο πράγμα που ίσως να θέλετε να παίξετε με το πόσοι είναι οι χαρακτήρες είναι εξόδου ως τιμή για εντοπισμό σφαλμάτων. Ψάξτε για αυτό και να τροποποιήσετε το δεύτερο αριθμό για να μεταβάλλουν την μέγιστη ισχύς χαρακτήρες: @ debug_print_var: 0:1000

Υ.Γ. Μπορεί κάποιος να καταλάβω γιατί έχω πάρει ένα χώρο πάνω από το <h3> στο σωστό κύτταρο;

Η ελπίδα αυτό βοηθά, ξέρω ότι μου αρέσει Χαμόγελο

Υ.Γ. Για να πάρετε όλο το javascript λειτουργεί σωστά το μόνο που χρειάζεται να τροποποιήσετε τη γραμμή "var mynanopath =" και βεβαιωθείτε ότι δείχνει δημόσιο κατάλογο nanopath σας. Μπορείτε κάτω από το πακέτο από nanotree http://sourceforge.net/projects/nanotree/

Εδώ είναι η ενημέρωση κώδικα

Κωδικός:
{*
Smarty προσαρμοσμένου προτύπου Debug DHTML
@ Συγγραφέας Hielke Hoeve
@ Συγγραφέας Όουεν Κόουλ <owenc στο ideamesh dot com>
@ Από 02/13/2006 Smarty 2.6.12
@ Πακέτο Smarty
@ Αρχείου debug.tpl
*}

{Assign_debug_info}

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

αν (self.name == ") {} ldelim
var = τίτλο «Κονσόλα»?
{Rdelim}
else {} ldelim
var = τίτλο «Console_ '+ self.name?
{Rdelim}
_smarty_console = window.open ("", title.value, "width = 800, height = 600, resizable, κύλισης = ναι")?
_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? περιθώριο: 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 ("# debugtreetextdiv div {} ldelim padding-αριστερά: 10px?} {rdelim \ n")?
_smarty_console.document.write ("<\ / span> \ 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 (ImagePath)?. να δείξουν πραγματικά το δέντρο \ 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 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 ("λειτουργία 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 Δέντρο Αντικαθιστά την κλασική έκδοση του Smarty Debug Console. ")? \ n")?
{Μετρητή $ + +}

{* Δημιουργία κόμβου για το πρότυπο περιλαμβάνει *}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« περιλαμβάνονται τα πρότυπα και τα αρχεία ρυθμίσεων (χρόνος φόρτωσης σε δευτερόλεπτα): ", pageIcon," ")?
_smarty_console.document.write ("<table width=\"100%\">")?
{Όνομα της ενότητας = βρόχο πρότυπα = $ _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% f"}) {αν% 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 (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}

{* Δημιουργία κόμβου για τις μεταβλητές εντοπισμού σφαλμάτων χρήστη *}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« μεταβλητές debug χρήστη: ', new Array (closedGif, openGif))? \ n ")?
_smarty_console.document.write ("rootNode.addChild (κόμβος {} μετρητή $)? \ n")?
_smarty_console.document.write ("var = κόμβο γονέα {} $ μετρητή? \ n")?
{Μετρητή $ + +}

{* Δημιουργία κόμβους για τις μεταβλητές εντοπισμού σφαλμάτων χρήστη *}
{Όνομα της ενότητας = Vars βρόχο = $ _user_debug}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα 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 (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{Sectionelse}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« Καμία πληροφορία Debug χρήστη ανατεθεί », HelpIcon)? \ n")?
_smarty_console.document.write ("parent.addChild (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{/ Τμήμα}

{* Δημιουργία κόμβου για τις μεταβλητές πρότυπο *}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« αποδίδεται μεταβλητές πρότυπο: "new Array (closedGif, openGif))? \ n")?
_smarty_console.document.write ("rootNode.addChild (κόμβος {} μετρητή $)? \ n")?
_smarty_console.document.write ("var = κόμβο γονέα {} $ μετρητή? \ n")?
{Μετρητή $ + +}

{* Δημιουργία κόμβους για τις μεταβλητές πρότυπο *}
{Όνομα της ενότητας = βρόχο Vars = $ _debug_keys}
{Αν $ _debug_keys [Vars]! = '_user_debug' && $ _debug_keys [Vars]! = '_user_debug_key'}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή}," {} ldelim $ {$ _debug_keys [Vars]} {} rdelim », pageIcon," {$ _debug_vals [Vars] | @ debug_print_var: 0:1000 | διαφυγής: javascript | διαφυγής: το javascript} ')? \ n ")?
_smarty_console.document.write ("parent.addChild (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{/ Αν}
{Sectionelse}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« Δεν αποδίδεται μεταβλητές πρότυπο », HelpIcon)? \ n")?
_smarty_console.document.write ("parent.addChild (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{/ Τμήμα}

{* Δημιουργία κόμβου για Smarty μεταβλητές αρχείο ρυθμίσεων *}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« αποδίδεται config αρχείο μεταβλητών (εξωτερικό πεδίο πρότυπο): «, new Array (closedGif, openGif))? \ n")?
_smarty_console.document.write ("rootNode.addChild (κόμβος {} μετρητή $)? \ n")?
_smarty_console.document.write ("var = κόμβο γονέα {} $ μετρητή? \ n")?
{Μετρητή $ + +}

{* Δημιουργία κόμβων παιδί για Smarty μεταβλητές αρχείο ρυθμίσεων *}
{Όνομα της ενότητας = βρόχο config_vars = $ _debug_config_keys}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα 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 (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{Sectionelse}
_smarty_console.document.write ("κόμβος {var $ μετρητή} = νέα TreeNode ({$ μετρητή},« Δεν ρυθμίσεων μεταβλητές έχουν ανατεθεί », HelpIcon)? \ n")?
_smarty_console.document.write ("parent.addChild (κόμβος {} μετρητή $)? \ n")?
{Μετρητή $ + +}
{/ Τμήμα}

_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 & Κονσόλα Debug <\ / h3>")?
_smarty_console.document.write ("κλικ <h4> για τις μεταβλητές στο δέντρο για το περιεχόμενό τους εμφανίζεται στη δεξιά πλευρά του πίνακα <\ / h4>.")?
_smarty_console.document.write ("<table border='0' id='debugtreetable'> <tr>")?
_smarty_console.document.write ("<td valign='top' style='width: 250px;'> <div id='debugtreediv'> & <\ / span> <\ / 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: ,
δημοσιεύτηκε στο Οδηγοί , Προγραμματισμός από Owen

Ακολουθήστε τα σχόλια μέσω του RSS Feed | Αφήστε ένα σχόλιο | Trackback URL

Αφήστε το σχόλιό σας

 
© 2008 - 2012 - All Rights Reserved - Ideamesh, Inc 22 ερωτήματα. 0,382 δευτερόλεπτα.