二月
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.286秒。