Feb กุมภาพันธ์
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty วิธีการ: แม่แบบการแก้ปัญหา Javascript

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: ดาวน์โหลดแพคเกจสามารถใช้ได้ที่นี่: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. ที่นี่รหัสการแก้ไขคือการทำงานและพร้อมที่จะไป ..

Here is the link where you can download the nanotree javascript… นี่คือลิงค์ที่คุณสามารถดาวน์โหลด nanotree จาวาสคริปต์เป็น ...
http://nanotree.sourceforge.net/ http://nanotree.sourceforge.net/

Replace my variable {$Site.framework_pub} appropriately so that the javascript and images can be loaded correctly. แทนที่ตัวแปร $ {} Site.framework_pub ของฉันอย่างเหมาะสมเพื่อให้จาวาสคริปต์และภาพที่สามารถโหลดได้อย่างถูกต้อง

Also please note, I have added in a section to handle user defined debug vars… My debug structure is named '_user_debug' and '_user_debug_key' ยังโปรดทราบฉันได้เพิ่มในส่วนที่จะจัดการกับตัวแปรการแก้ปัญหาที่ผู้ใช้กำหนด ... โครงสร้างการแก้ปัญหาของฉันคือที่ชื่อว่า '_user_debug' และ '_user_debug_key'

For more info on how to implement this look at this thread : สำหรับข้อมูลเพิ่มเติมเกี่ยวกับวิธีการใช้ดูที่กระทู้นี้:
http://www.smarty.net/forums/viewtopic.php?p=31241#31241 http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Otherwise if you aren't interested, it is safe to remove that section from the template. มิฉะนั้นถ้าคุณไม่ได้สนใจจะปลอดภัยที่จะลบส่วนที่จากแม่แบบ You could also remove the {if} statement I used to wrap the template var section. นอกจากนี้คุณยังสามารถลบคำสั่ง {} ถ้าผมใช้ในการตัดส่วน var แม่

Another thing you might want to play with is how many characters are output as the value for debug. สิ่งที่คุณอาจต้องการที่จะเล่นกับอีกประการหนึ่งคือวิธีการหลายตัวอักษรออกเป็นความคุ้มค่าต่อการแก้ปัญหา Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 มองหานี้และแก้ไขตัวเลขที่สองที่จะปรับเปลี่ยนการแสดงผลตัวอักษรสูงสุด: debug_print_var @: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? พีเอสทุกคนสามารถคิดออกว่าทำไมฉันได้รับพื้นที่อากาศด้านบน <h3> ในเซลล์ที่เหมาะสมหรือไม่

Hope this helps, I know I like it หวังว่านี้จะช่วยให้ฉันรู้ว่าฉันชอบมัน รอยยิ้ม

PS To get all the javascript working correctly you only need to modify the line “var mynanopath = ” and make sure it points to your public nanopath directory. พีเอสเพื่อให้ได้ทั้งหมดจาวาสคริปต์ทำงานอย่างถูกต้องคุณจะต้องปรับเปลี่ยนบรรทัด "var mynanopath =" และให้แน่ใจว่ามันชี้ไปยังไดเรกทอรี nanopath สาธารณะของคุณ You can down the nanotree package from http://sourceforge.net/projects/nanotree/ คุณสามารถลงแพคเกจ nanotree จาก http://sourceforge.net/projects/nanotree/

Here is the updated code ที่นี่รหัสปรับปรุง

Code: รหัสสินค้า:
{* {*
Smarty Custom DHTML Debug Template แม่แบบที่กำหนดเอง Smarty Debug DHTML
@author Hielke Hoeve @ ผู้เขียน Hoeve Hielke
@author Owen Cole <owenc at ideamesh dot com> @ ผู้เขียนโอเว่นโคล <owenc ที่ ideamesh จุด com>
@since 02/13/2006 Smarty 2.6.12 @ ตั้งแต่ 2006/02/13 Smarty 2.6.12
@package Smarty @ Smarty แพคเกจ
@filename debug.tpl @ debug.tpl ชื่อไฟล์
*} *}

{assign_debug_info} {} assign_debug_info

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

if( self.name == ” ) {ldelim} ถ้า (self.name == ") {} ldelim
var title = 'Console'; var ชื่อ = 'คอนโซล';
{rdelim} {} rdelim
else {ldelim} else {} ldelim
var title = 'Console_' + self.name; var ชื่อ = 'Console_' + self.name;
{rdelim} {} rdelim
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value, "width = 800, height = 600 เลื่อนปรับขนาด = ใช่");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Debug Smarty Console_" + + self.name "<\ / title> \ n");
_smarty_console.document.write(”<style>\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 ("h3 {padding ldelim}: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; background-color: # cccccc;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable {ldelim}width : 100%;{rdelim} \n”); _smarty_console.document.write ("{width ldelim} debugtreetable #: 100%;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable td {ldelim}border : thin solid black;{rdelim} \n”); _smarty_console.document.write ("debugtreetable # ชายแดน TD {} ldelim: บางสีดำ;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetextdiv div {ldelim}padding-left : 10px;{rdelim} \n”); _smarty_console.document.write ("# debugtreetextdiv div {} ldelim padding ซ้าย: 10px;} {rdelim \ n");
_smarty_console.document.write(”<\/style>\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 language=\"Javascript\" src=\"" + + mynanopath "nanotree.js\"> <\ / script> \ n");
_smarty_console.document.write(”<script type=\”text\/javascript\” language=\”JavaScript\”>\n”); _smarty_console.document.write ("<script type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write(”<!–\n”); _smarty_console.document.write ("<- \ n");
_smarty_console.document.write(” showRootNode = true;\n”); _smarty_console.document.write ("showRootNode = true; \ n");
_smarty_console.document.write(” sortNodes = 0;\n”); _smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write(” dragable = false;\n”); _smarty_console.document.write ("dragable = false; \ n");
_smarty_console.document.write(” showAllNodesOnStartup = true;\n”); _smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Needed to initialize the tree.\n”); _smarty_console.document.write ("* ที่จำเป็นในการเริ่มต้นต้นไม้ \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* และจะเรียก showTree (ImagePath);. จริงแสดงต้นไม้ \ n");
_smarty_console.document.write(” * Alternatively this can be done in a script block at the bottom of the page.\n”); _smarty_console.document.write ("* ผลัดกันนี้สามารถทำได้ในบล็อกสคริปต์ที่ด้านล่างของหน้า \ n.");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* แม้ว่าวิธีนี้คือการทำความสะอาดค่อนข้าง \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชัน init () {} ldelim \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("document.getElementById ภาชนะ = ('debugtreediv'); \ n");
_smarty_console.document.write(” showTree('” + mynanopath + “');\n”); _smarty_console.document.write ("showTree ('" + + mynanopath "'); \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Called when a user clicks on a node.\n”); _smarty_console.document.write ("* เรียกว่าเมื่อผู้ใช้คลิกที่โหนด \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ พระราม TreeNode วัตถุ TreeNode ที่ได้รับการคลิก \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชั่น standardClick (ทำใจ) {} ldelim \ n");
_smarty_console.document.write(” var mytext = document.getElementById('debugtreetextdiv');\n”); _smarty_console.document.write ("var MyText = document.getElementById ('debugtreetextdiv'); \ n");
_smarty_console.document.write(” var param = treeNode.getParam();\n”); _smarty_console.document.write ("var พระราม = treeNode.getParam (); \ n");
_smarty_console.document.write(” mytext.innerHTML = (param == ”) ? treeNode.getName() : '<h3>' + treeNode.getName() + '<\/h3><div>' + param + '<\/div>';\n”); _smarty_console.document.write ("mytext.innerHTML = (Param ==") treeNode.getName (): '<h3>' + treeNode.getName () + '<\ / h3> <div>' พระราม + + + ' <\ / div> '\ n ");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” function nodeEdited(treeNode) {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชั่น nodeEdited (ทำใจ) {} ldelim \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” var closedGif = '” + mynanopath + “images\/folder_closed.gif';\n”); _smarty_console.document.write ("var closedGif = '" + mynanopath + "\ Images / folder_closed.gif' \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + mynanopath + "\ Images / folder_open.gif' \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + mynanopath + "\ Images / page16 × 16.gif' \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var userIcon = '" + mynanopath + "\ Images / user_16 × 16.gif' \ n");
_smarty_console.document.write(” var helpIcon = '” + mynanopath + “images\/help_16×16.gif';\n”); _smarty_console.document.write ("var helpIcon = '" + mynanopath + "\ Images / help_16 × 16.gif' \ n");

{* Create base node *} {* สร้าง * โหนดฐาน}
{assign var=counter value=0} {กำหนด var = มูลค่าเคาน์เตอร์ = 0}
_smarty_console.document.write(” rootNode = new TreeNode({$counter},'Smarty Debug', helpIcon, 'This is the Debug Tree. It replaces the classical version of the Smarty Debug Console');\n”); _smarty_console.document.write ("rootNode = ใหม่ TreeNode ({$ เคาน์เตอร์} 'Debug Smarty' helpIcon นี่คือต้นไม้ Debug แทนที่รุ่นคลาสสิกของคอนโซลการตรวจแก้จุดบกพร่อง Smarty. '); \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create node for template includes *} {* สร้างโหนดสำหรับแม่แบบรวมถึง *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'รวมแม่แบบและ config ไฟล์ (เวลาในการโหลดวินาที):', pageIcon, '");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {ชื่อส่วน = ห่วงแม่ = $ _debug_tpls}
_smarty_console.document.write(”<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&&&{/section}<font color={if $_debug_tpls[templates].type eq “template”}brown{elseif $_debug_tpls[templates].type eq _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[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:”%.5f”}){if %templates.index% eq 0} (total){/if}<\\/i><\\/font>{/if}<\\/tt><\\/td><\\/tr>”); 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} {} sectionelse
_smarty_console.document.write(”<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included<\\/i><\\/tt><\\/td><\\/tr>”); _smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> แม่แบบไม่รวม <\ \ / i> <\ \ / TT> <\ \ / td> <\ \ / tr> ");
{/section} ส่วน {/}
_smarty_console.document.write(”<\\/table>”); _smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write(”');\n”); _smarty_console.document.write ("'); \ n");

_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create node for user debug variables *} {* สร้างโหนดสำหรับตัวแปรการแก้ปัญหาของผู้ใช้ *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ตัวแปรการแก้ปัญหาผู้ใช้:', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for user debug variables *} {* สร้างโหนดลูกสำหรับตัวแปรการแก้ปัญหาของผู้ใช้ *}
{section name=vars loop=$_user_debug} {ชื่อส่วน = ห่วงตัวแปร = _user_debug $}
_smarty_console.document.write(” var node{$counter} = new 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 (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _user_debug_key [ตัวแปร]} {rdelim}', pageIcon, '{$ _user_debug [ตัวแปร] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีข้อมูลการแก้ปัญหาผู้ใช้งานที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

{* Create node for template variables *} {* สร้างโหนดสำหรับแม่แบบ * ตัวแปร}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์}, 'กำหนดตัวแปรแม่แบบ:', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for template variables *} {* สร้างโหนดลูกแม่แบบสำหรับตัวแปร *}
{section name=vars loop=$_debug_keys} {ชื่อส่วน = ห่วงตัวแปร = $ _debug_keys}
{ if $_debug_keys[vars] != '_user_debug' && $_debug_keys[vars] != '_user_debug_key' } {ถ้า $ _debug_keys [ตัวแปร] = && '_user_debug' $ _debug_keys [ตัวแปร] = '_user_debug_key'}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_keys[vars]}{rdelim}', pageIcon, '{$_debug_vals[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _debug_keys [ตัวแปร]} {rdelim}', pageIcon, '{$ _debug_vals [ตัวแปร] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/if} {/ ถ้า}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No template variables assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีตัวแปรแม่แบบที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

{* Create node for smarty config file variables *} {* สร้างโหนดสำหรับตัวแปรไฟล์ config Smarty *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned config file variables (outer template scope):', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์}, 'กำหนดค่าตัวแปรไฟล์ (ขอบเขตแม่แบบด้านนอก):', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for smarty config file variables *} {* สร้างโหนดลูกสำหรับตัวแปรไฟล์ config Smarty *}
{section name=config_vars loop=$_debug_config_keys} {ชื่อส่วน = ห่วง config_vars = $ _debug_config_keys}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{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 (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim}', pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีการตั้งค่าตัวแปรที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

_smarty_console.document.write(”\/\/–>\n”); _smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write(”<\/script>\n\n”); _smarty_console.document.write ("<\ / script> \ n \ n");
_smarty_console.document.write(”<\/head><body onload=\”init()\”>\n”); _smarty_console.document.write ("<\ / head> <body onload=\"init()\"> \ n");
_smarty_console.document.write(”<h3>Smarty & User Debug Console<\/h3>”); _smarty_console.document.write ("<h3> Smarty และคอนโซลการแก้ปัญหาการใช้งาน <\ / h3>");
_smarty_console.document.write(”<h4>Click on variables in the tree to have their contents displayed in the right side panel.<\/h4>”); _smarty_console.document.write ("คลิก <h4> กับตัวแปรในต้นไม้จะมีเนื้อหาของพวกเขาแสดงในแผงด้านขวา <\ / h4>.");
_smarty_console.document.write(”<table border='0′ id='debugtreetable'><tr>”); _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 ("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 ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write(”<\/tr><\/table>”); _smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write(”<\/body><\/html>”); _smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close(); _smarty_console.document.close ();
</SCRIPT> </ script>

tags: , Tags: ,
posted in Guides , Programming by Owen โพสต์ใน ภาษา , การเขียนโปรแกรม โดยโอเว่น

Follow comments via the RSS Feed | Leave a comment | Trackback URL ติดตามความคิดเห็นผ่านทาง RSS ฟีด | ฝากความคิดเห็น | Trackback URL

Leave Your Comment ฝากความเห็นของคุณ

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - สงวนลิขสิทธิ์ - Ideamesh, Inc 22 คำสั่ง 0.274 seconds. 0.274 วินาที
Smarty วิธีการ: แม่แบบการแก้ปัญหา Javascript | Ideamesh
Feb กุมภาพันธ์
13 13
2006 2006

Smarty How to: Javascript Debug Template Smarty วิธีการ: แม่แบบการแก้ปัญหา Javascript

UPDATE : A download package is available here : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html UPDATE: ดาวน์โหลดแพคเกจสามารถใช้ได้ที่นี่: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

Here is the modified code, working and ready to go.. ที่นี่รหัสการแก้ไขคือการทำงานและพร้อมที่จะไป ..

Here is the link where you can download the nanotree javascript… นี่คือลิงค์ที่คุณสามารถดาวน์โหลด nanotree จาวาสคริปต์เป็น ...
http://nanotree.sourceforge.net/ http://nanotree.sourceforge.net/

Replace my variable {$Site.framework_pub} appropriately so that the javascript and images can be loaded correctly. แทนที่ตัวแปร $ {} Site.framework_pub ของฉันอย่างเหมาะสมเพื่อให้จาวาสคริปต์และภาพที่สามารถโหลดได้อย่างถูกต้อง

Also please note, I have added in a section to handle user defined debug vars… My debug structure is named '_user_debug' and '_user_debug_key' ยังโปรดทราบฉันได้เพิ่มในส่วนที่จะจัดการกับตัวแปรการแก้ปัญหาที่ผู้ใช้กำหนด ... โครงสร้างการแก้ปัญหาของฉันคือที่ชื่อว่า '_user_debug' และ '_user_debug_key'

For more info on how to implement this look at this thread : สำหรับข้อมูลเพิ่มเติมเกี่ยวกับวิธีการใช้ดูที่กระทู้นี้:
http://www.smarty.net/forums/viewtopic.php?p=31241#31241 http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Otherwise if you aren't interested, it is safe to remove that section from the template. มิฉะนั้นถ้าคุณไม่ได้สนใจจะปลอดภัยที่จะลบส่วนที่จากแม่แบบ You could also remove the {if} statement I used to wrap the template var section. นอกจากนี้คุณยังสามารถลบคำสั่ง {} ถ้าผมใช้ในการตัดส่วน var แม่

Another thing you might want to play with is how many characters are output as the value for debug. สิ่งที่คุณอาจต้องการที่จะเล่นกับอีกประการหนึ่งคือวิธีการหลายตัวอักษรออกเป็นความคุ้มค่าต่อการแก้ปัญหา Look for this and modify the second number to alter the max chars output :@debug_print_var:0:1000 มองหานี้และแก้ไขตัวเลขที่สองที่จะปรับเปลี่ยนการแสดงผลตัวอักษรสูงสุด: debug_print_var @: 0:1000

PS Can anyone figure out why I am getting a space above the <h3> in the right cell? พีเอสทุกคนสามารถคิดออกว่าทำไมฉันได้รับพื้นที่อากาศด้านบน <h3> ในเซลล์ที่เหมาะสมหรือไม่

Hope this helps, I know I like it หวังว่านี้จะช่วยให้ฉันรู้ว่าฉันชอบมัน รอยยิ้ม

PS To get all the javascript working correctly you only need to modify the line “var mynanopath = ” and make sure it points to your public nanopath directory. พีเอสเพื่อให้ได้ทั้งหมดจาวาสคริปต์ทำงานอย่างถูกต้องคุณจะต้องปรับเปลี่ยนบรรทัด "var mynanopath =" และให้แน่ใจว่ามันชี้ไปยังไดเรกทอรี nanopath สาธารณะของคุณ You can down the nanotree package from http://sourceforge.net/projects/nanotree/ คุณสามารถลงแพคเกจ nanotree จาก http://sourceforge.net/projects/nanotree/

Here is the updated code ที่นี่รหัสปรับปรุง

Code: รหัสสินค้า:
{* {*
Smarty Custom DHTML Debug Template แม่แบบที่กำหนดเอง Smarty Debug DHTML
@author Hielke Hoeve @ ผู้เขียน Hoeve Hielke
@author Owen Cole <owenc at ideamesh dot com> @ ผู้เขียนโอเว่นโคล <owenc ที่ ideamesh จุด com>
@since 02/13/2006 Smarty 2.6.12 @ ตั้งแต่ 2006/02/13 Smarty 2.6.12
@package Smarty @ Smarty แพคเกจ
@filename debug.tpl @ debug.tpl ชื่อไฟล์
*} *}

{assign_debug_info} {} assign_debug_info

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

if( self.name == ” ) {ldelim} ถ้า (self.name == ") {} ldelim
var title = 'Console'; var ชื่อ = 'คอนโซล';
{rdelim} {} rdelim
else {ldelim} else {} ldelim
var title = 'Console_' + self.name; var ชื่อ = 'Console_' + self.name;
{rdelim} {} rdelim
_smarty_console = window.open(”",title.value,”width=800,height=600,resizable,scrollbars=yes”); _smarty_console = window.open ("", title.value, "width = 800, height = 600 เลื่อนปรับขนาด = ใช่");
_smarty_console.document.write(”<html><head><title>Smarty Debug Console_”+self.name+”<\/title>\n”); _smarty_console.document.write ("<html> <head> <title> Debug Smarty Console_" + + self.name "<\ / title> \ n");
_smarty_console.document.write(”<style>\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 ("h3 {padding ldelim}: 5px 5px 5px 5px; margin: 0px 0px 0px 0px; background-color: # cccccc;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable {ldelim}width : 100%;{rdelim} \n”); _smarty_console.document.write ("{width ldelim} debugtreetable #: 100%;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetable td {ldelim}border : thin solid black;{rdelim} \n”); _smarty_console.document.write ("debugtreetable # ชายแดน TD {} ldelim: บางสีดำ;} {rdelim \ n");
_smarty_console.document.write(”#debugtreetextdiv div {ldelim}padding-left : 10px;{rdelim} \n”); _smarty_console.document.write ("# debugtreetextdiv div {} ldelim padding ซ้าย: 10px;} {rdelim \ n");
_smarty_console.document.write(”<\/style>\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 language=\"Javascript\" src=\"" + + mynanopath "nanotree.js\"> <\ / script> \ n");
_smarty_console.document.write(”<script type=\”text\/javascript\” language=\”JavaScript\”>\n”); _smarty_console.document.write ("<script type=\"text\/javascript\" language=\"JavaScript\"> \ n");
_smarty_console.document.write(”<!–\n”); _smarty_console.document.write ("<- \ n");
_smarty_console.document.write(” showRootNode = true;\n”); _smarty_console.document.write ("showRootNode = true; \ n");
_smarty_console.document.write(” sortNodes = 0;\n”); _smarty_console.document.write ("sortNodes = 0; \ n");
_smarty_console.document.write(” dragable = false;\n”); _smarty_console.document.write ("dragable = false; \ n");
_smarty_console.document.write(” showAllNodesOnStartup = true;\n”); _smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Needed to initialize the tree.\n”); _smarty_console.document.write ("* ที่จำเป็นในการเริ่มต้นต้นไม้ \ n.");
_smarty_console.document.write(” * And to call showTree(imagePath); to actually show the tree.\n”); _smarty_console.document.write ("* และจะเรียก showTree (ImagePath);. จริงแสดงต้นไม้ \ n");
_smarty_console.document.write(” * Alternatively this can be done in a script block at the bottom of the page.\n”); _smarty_console.document.write ("* ผลัดกันนี้สามารถทำได้ในบล็อกสคริปต์ที่ด้านล่างของหน้า \ n.");
_smarty_console.document.write(” * Though this method is somewhat cleaner.\n”); _smarty_console.document.write ("* แม้ว่าวิธีนี้คือการทำความสะอาดค่อนข้าง \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function init() {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชัน init () {} ldelim \ n");
_smarty_console.document.write(” container = document.getElementById('debugtreediv');\n”); _smarty_console.document.write ("document.getElementById ภาชนะ = ('debugtreediv'); \ n");
_smarty_console.document.write(” showTree('” + mynanopath + “');\n”); _smarty_console.document.write ("showTree ('" + + mynanopath "'); \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” \/**\n”); _smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write(” * Called when a user clicks on a node.\n”); _smarty_console.document.write ("* เรียกว่าเมื่อผู้ใช้คลิกที่โหนด \ n.");
_smarty_console.document.write(” * @param treeNode the TreeNode object which have been clicked.\n”); _smarty_console.document.write ("* @ พระราม TreeNode วัตถุ TreeNode ที่ได้รับการคลิก \ n.");
_smarty_console.document.write(” *\/\n”); _smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write(” function standardClick(treeNode) {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชั่น standardClick (ทำใจ) {} ldelim \ n");
_smarty_console.document.write(” var mytext = document.getElementById('debugtreetextdiv');\n”); _smarty_console.document.write ("var MyText = document.getElementById ('debugtreetextdiv'); \ n");
_smarty_console.document.write(” var param = treeNode.getParam();\n”); _smarty_console.document.write ("var พระราม = treeNode.getParam (); \ n");
_smarty_console.document.write(” mytext.innerHTML = (param == ”) ? treeNode.getName() : '<h3>' + treeNode.getName() + '<\/h3><div>' + param + '<\/div>';\n”); _smarty_console.document.write ("mytext.innerHTML = (Param ==") treeNode.getName (): '<h3>' + treeNode.getName () + '<\ / h3> <div>' พระราม + + + ' <\ / div> '\ n ");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” function nodeEdited(treeNode) {ldelim}\n”); _smarty_console.document.write ("ฟังก์ชั่น nodeEdited (ทำใจ) {} ldelim \ n");
_smarty_console.document.write(” {rdelim}\n”); _smarty_console.document.write ("{} rdelim \ n");

_smarty_console.document.write(” var closedGif = '” + mynanopath + “images\/folder_closed.gif';\n”); _smarty_console.document.write ("var closedGif = '" + mynanopath + "\ Images / folder_closed.gif' \ n");
_smarty_console.document.write(” var openGif = '” + mynanopath + “images\/folder_open.gif';\n”); _smarty_console.document.write ("var openGif = '" + mynanopath + "\ Images / folder_open.gif' \ n");
_smarty_console.document.write(” var pageIcon = '” + mynanopath + “images\/page16×16.gif';\n”); _smarty_console.document.write ("var pageIcon = '" + mynanopath + "\ Images / page16 × 16.gif' \ n");
_smarty_console.document.write(” var userIcon = '” + mynanopath + “images\/user_16×16.gif';\n”); _smarty_console.document.write ("var userIcon = '" + mynanopath + "\ Images / user_16 × 16.gif' \ n");
_smarty_console.document.write(” var helpIcon = '” + mynanopath + “images\/help_16×16.gif';\n”); _smarty_console.document.write ("var helpIcon = '" + mynanopath + "\ Images / help_16 × 16.gif' \ n");

{* Create base node *} {* สร้าง * โหนดฐาน}
{assign var=counter value=0} {กำหนด var = มูลค่าเคาน์เตอร์ = 0}
_smarty_console.document.write(” rootNode = new TreeNode({$counter},'Smarty Debug', helpIcon, 'This is the Debug Tree. It replaces the classical version of the Smarty Debug Console');\n”); _smarty_console.document.write ("rootNode = ใหม่ TreeNode ({$ เคาน์เตอร์} 'Debug Smarty' helpIcon นี่คือต้นไม้ Debug แทนที่รุ่นคลาสสิกของคอนโซลการตรวจแก้จุดบกพร่อง Smarty. '); \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create node for template includes *} {* สร้างโหนดสำหรับแม่แบบรวมถึง *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'included templates & config files (load time in seconds):', pageIcon, '”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'รวมแม่แบบและ config ไฟล์ (เวลาในการโหลดวินาที):', pageIcon, '");
_smarty_console.document.write(”<table width=\”100%\”>”); _smarty_console.document.write ("<table width=\"100%\">");
{section name=templates loop=$_debug_tpls} {ชื่อส่วน = ห่วงแม่ = $ _debug_tpls}
_smarty_console.document.write(”<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth}&&&{/section}<font color={if $_debug_tpls[templates].type eq “template”}brown{elseif $_debug_tpls[templates].type eq _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[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:”%.5f”}){if %templates.index% eq 0} (total){/if}<\\/i><\\/font>{/if}<\\/tt><\\/td><\\/tr>”); 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} {} sectionelse
_smarty_console.document.write(”<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included<\\/i><\\/tt><\\/td><\\/tr>”); _smarty_console.document.write ("<tr bgcolor=#eeeeee> <td colspan=2> <tt> <i> แม่แบบไม่รวม <\ \ / i> <\ \ / TT> <\ \ / td> <\ \ / tr> ");
{/section} ส่วน {/}
_smarty_console.document.write(”<\\/table>”); _smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write(”');\n”); _smarty_console.document.write ("'); \ n");

_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create node for user debug variables *} {* สร้างโหนดสำหรับตัวแปรการแก้ปัญหาของผู้ใช้ *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'user debug variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ตัวแปรการแก้ปัญหาผู้ใช้:', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for user debug variables *} {* สร้างโหนดลูกสำหรับตัวแปรการแก้ปัญหาของผู้ใช้ *}
{section name=vars loop=$_user_debug} {ชื่อส่วน = ห่วงตัวแปร = _user_debug $}
_smarty_console.document.write(” var node{$counter} = new 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 (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _user_debug_key [ตัวแปร]} {rdelim}', pageIcon, '{$ _user_debug [ตัวแปร] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No User Debug Information assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีข้อมูลการแก้ปัญหาผู้ใช้งานที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

{* Create node for template variables *} {* สร้างโหนดสำหรับแม่แบบ * ตัวแปร}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned template variables:', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์}, 'กำหนดตัวแปรแม่แบบ:', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for template variables *} {* สร้างโหนดลูกแม่แบบสำหรับตัวแปร *}
{section name=vars loop=$_debug_keys} {ชื่อส่วน = ห่วงตัวแปร = $ _debug_keys}
{ if $_debug_keys[vars] != '_user_debug' && $_debug_keys[vars] != '_user_debug_key' } {ถ้า $ _debug_keys [ตัวแปร] = && '_user_debug' $ _debug_keys [ตัวแปร] = '_user_debug_key'}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{ldelim}${$_debug_keys[vars]}{rdelim}', pageIcon, '{$_debug_vals[vars]|@debug_print_var:0:1000|escape:javascript|escape:javascript}' );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _debug_keys [ตัวแปร]} {rdelim}', pageIcon, '{$ _debug_vals [ตัวแปร] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/if} {/ ถ้า}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No template variables assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีตัวแปรแม่แบบที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

{* Create node for smarty config file variables *} {* สร้างโหนดสำหรับตัวแปรไฟล์ config Smarty *}
_smarty_console.document.write(” var node{$counter} = new TreeNode({$counter}, 'assigned config file variables (outer template scope):', new Array(closedGif,openGif) );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์}, 'กำหนดค่าตัวแปรไฟล์ (ขอบเขตแม่แบบด้านนอก):', อาร์เรย์ใหม่ (closedGif, openGif)) \ n");
_smarty_console.document.write(” rootNode.addChild(node{$counter});\n”); _smarty_console.document.write ("rootNode.addChild (โหนด {$ เคาน์เตอร์}) \ n");
_smarty_console.document.write(” var parent = node{$counter};\n”); _smarty_console.document.write ("var โหนดแม่ = {$ เคาน์เตอร์} \ n");
{$counter++} {$ เคาน์เตอร์ + + +}

{* Create child nodes for smarty config file variables *} {* สร้างโหนดลูกสำหรับตัวแปรไฟล์ config Smarty *}
{section name=config_vars loop=$_debug_config_keys} {ชื่อส่วน = ห่วง config_vars = $ _debug_config_keys}
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, '{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 (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} '{ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim}', pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | หนี: จาวาสคริปต์ | หนี: จาวาสคริปต์} '); \ n ");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{sectionelse} {} sectionelse
_smarty_console.document.write(” var node{$counter} = new TreeNode( {$counter}, 'No config variables assigned', HelpIcon );\n”); _smarty_console.document.write (โหนด "{var $ เคาน์เตอร์} = ใหม่ TreeNode ({$ เคาน์เตอร์} 'ไม่มีการตั้งค่าตัวแปรที่ได้รับมอบหมาย', HelpIcon) \ n");
_smarty_console.document.write(” parent.addChild(node{$counter});\n”); _smarty_console.document.write ("parent.addChild (โหนด {$ เคาน์เตอร์}) \ n");
{$counter++} {$ เคาน์เตอร์ + + +}
{/section} ส่วน {/}

_smarty_console.document.write(”\/\/–>\n”); _smarty_console.document.write ("\ / \ / -> \ n");
_smarty_console.document.write(”<\/script>\n\n”); _smarty_console.document.write ("<\ / script> \ n \ n");
_smarty_console.document.write(”<\/head><body onload=\”init()\”>\n”); _smarty_console.document.write ("<\ / head> <body onload=\"init()\"> \ n");
_smarty_console.document.write(”<h3>Smarty & User Debug Console<\/h3>”); _smarty_console.document.write ("<h3> Smarty และคอนโซลการแก้ปัญหาการใช้งาน <\ / h3>");
_smarty_console.document.write(”<h4>Click on variables in the tree to have their contents displayed in the right side panel.<\/h4>”); _smarty_console.document.write ("คลิก <h4> กับตัวแปรในต้นไม้จะมีเนื้อหาของพวกเขาแสดงในแผงด้านขวา <\ / h4>.");
_smarty_console.document.write(”<table border='0′ id='debugtreetable'><tr>”); _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 ("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 ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write(”<\/tr><\/table>”); _smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write(”<\/body><\/html>”); _smarty_console.document.write ("<\ / body> <\ / html>");
_smarty_console.document.close(); _smarty_console.document.close ();
</SCRIPT> </ script>

tags: , Tags: ,
posted in Guides , Programming by Owen โพสต์ใน ภาษา , การเขียนโปรแกรม โดยโอเว่น

Follow comments via the RSS Feed | Leave a comment | Trackback URL ติดตามความคิดเห็นผ่านทาง RSS ฟีด | ฝากความคิดเห็น | Trackback URL

Leave Your Comment ฝากความเห็นของคุณ

© 2008 - 2013 — All Rights Reserved — Ideamesh, Inc. 22 queries. © 2008 - 2013 - สงวนลิขสิทธิ์ - Ideamesh, Inc 22 คำสั่ง 0.274 seconds. 0.274 วินาที