二月
13
2006

Smarty怎樣的JavaScript調試模板

更新:這裡提供一個下載包: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

下面是修改後的代碼,工作和準備去......

下面是鏈接在這裡您可以下載nanotree的JavaScript ...
http://nanotree.sourceforge.net/~~V

替換變量{$ Site.framework_pub}適當的,因此,可以正確加載JavaScript和圖像。

還請注意,我在一節中添加處理用戶定義的調試瓦爾...我調試結構被命名為'_user_debug'和'_user_debug_key“

如需就如何落實這一看看這個線程的詳細信息:
http://www.smarty.net/forums/viewtopic.php?p=31241#31241

否則,如果你不感興趣,它是安全的,從模板中刪除該條。 你也可以刪除{}聲明,我用來包裹模板VAR部分。

作為用於調試的值是多少字符輸出,你可能要玩的是另一件事。 尋找和修改第二個數字來改變最大輸出字符:@ debug_print_var:0:1000

PS可以弄清楚為什麼我得到正確的細胞以上的<H3>空間?

希望這會有所幫助,我知道我喜歡它 微笑

PS 要獲得所有的JavaScript正常工作,你只需要修改行“mynanopath =”,並確保它指向你的的公共nanopath目錄。 下來,你可以從nanotree包http://sourceforge.net/projects/nanotree/

下面是更新後的代碼

代碼:
{*
Smarty的自定義DHTML調試模板
@作者Hielke HOEVE
@作者歐文·科爾<owenc在ideamesh點com>
自2006年2月13日Smarty的2.6.12
_AT_包Smarty的
_AT_名文件debug.tpl
*}

{assign_debug_info}

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

(self.name ==“){ldelim}
標題='控制台';
{rdelim}
其他{ldelim}
標題=“Console_ + self.name;
{rdelim}
_smarty_console的window.open(“”,title.value,“寬度= 800,高度= 600,調整大小,滾動條= YES”);
_smarty_console.document.write(“<HTML> <HEAD> <TITLE> Smarty的調試Console_”self.name“<\ /標題> \ 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(“:#debugtreetextdiv DIV {ldelim}左:10px; {rdelim} \ N”);
_smarty_console.document.write(“<\ /> \ 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 = TRUE; \ N”);

_smarty_console.document.write(“\ / ** \ N”);
_smarty_console.document.write(*所需的初始化樹\ N“);
_smarty_console.document.write(“*,並呼籲showTree(的ImagePath);實際上顯示的樹\”);
_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(“容器=(”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(“* @參數的TreeNode TreeNode對象已被點擊的變動\ n”);
_smarty_console.document.write(“* \ / \ N”);
_smarty_console.document.write(“,功能standardClick(TreeNode的){ldelim} \ N”);
_smarty_console.document.write(VAR MYTEXT =(“debugtreetextdiv); \ N”);
_smarty_console.document.write(“參數= treeNode.getParam(); \ N”);
_smarty_console.document.write(的“mytext.innerHTML =(參數==”)treeNode.getName():“<H3> + treeNode.getName()+”<\ / H3> <DIV>“的+參數+” <\ / DIV>'; \ 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({$計數器}”,Smarty的調試,helpIcon,“這是調試樹,它取代了Smarty的調試控制台的經典版本。”); \ 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 [模板]。型式“模板”棕色{ELSEIF美元_debug_tpls [模板]。型方程 使用isset($ _debug_tpls [模板] exec_time。)} <font size=-1>鍵<I>({$ _debug_tpls [模板] exec_time | string_format:“%.5 f”}){}如果%templates.index的%EQ 0 (總){/如果} <\ \ / I> <\ \ / FONT> {/如果} <\ \ / TT> <\ \ / TD> <\ \ / TR>“);
{sectionelse}
_smarty_console.document.write(“<tr bgcolor=#eeeeee> <td colspan=2> <TT>”沒有模板,包括<\ \ / 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({$計數器},”用戶調試變量:',新的陣列(closedGif,openGif)); \ N“);
_smarty_console.document.write(“rootNode.addChild(節點{計數器$}); \ N”);
_smarty_console.document.write(“父=節點{$計數器} \ N”);
{$計數器+ +}

{*創建子節點,為用戶調試變量*}
{節的名稱= VARS循環= $ _user_debug}
(“VAR節點{$計數器_smarty_console.document.write} =新的TreeNode({$計數器},{ldelim} $ $ _user_debug_key [瓦爾]} {rdelim}',pageIcon,'{$ _user_debug [瓦爾] | @ 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(“VAR節點{$計數器} =新的TreeNode({$計數器}”,指定模板變量:',新的陣列(closedGif,openGif)); \ N“);
_smarty_console.document.write(“rootNode.addChild(節點{計數器$}); \ N”);
_smarty_console.document.write(“父=節點{$計數器} \ N”);
{$計數器+ +}

{*創建子節點模板變量*}
{節的名稱= VARS循環= $ _debug_keys}
{如果$ _debug_keys [瓦爾] ='_user_debug'&& $ _debug_keys [瓦爾] ='_user_debug_key'}
中_smarty_console.document.write(“VAR節點{$計數器} =新的TreeNode({$計數器},{ldelim} $ {$ _debug_keys [瓦爾]} {rdelim}',pageIcon,'{$ _debug_vals [瓦爾] | @ 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({$計數器},”指定配置文件變量(外部模板的範圍):“新的Array(closedGif,openGif)); \ N”);
_smarty_console.document.write(“rootNode.addChild(節點{計數器$}); \ N”);
_smarty_console.document.write(“父=節點{$計數器} \ 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(“\ / \ / - > \”);
_smarty_console.document.write(“<\ / SCRIPT> \ N \ N”);
_smarty_console.document.write(“<\ / HEAD> <body onload=\"init()\"> \ N”);
_smarty_console.document.write(“<H3> Smarty的用戶調試控制台<\ / H3>”);
<\ / H4 _smarty_console.document.write(“<H4>點擊樹有其內容顯示在右側面板中的變量。”);
_smarty_console.document.write(“<table border='0' id='debugtreetable'> <TR>”);
(“<td valign='top' _smarty_console.document.write style='width: 250px;'> <div id='debugtreediv'>&<\ / DIV> <\ / TD>”);
_smarty_console.document.write(“<td valign='top'> <div id='debugtreetextdiv'>&<\ / TD>”);
_smarty_console.document.write(“<\ / TR> <\ /表>”);
_smarty_console.document.write(“<\ / BODY> <\ / HTML>”);
_smarty_console.document.close();
</ SCRIPT>

標籤:
發布指南編程由歐文

後續評論通過RSS頻道 | 發表評論 | 引用網址

留下您的評論

 
©2008 - 2012 -版權所有- Ideamesh公司 22個查詢。 0.304秒。