2월
13
2006

방법에 대한 멋지 : 자바 스크립트 디버그 템플릿

업데이트 : 다운로드 패키지는 여기에 있습니다 : http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

여기에서 수정된 코드가 작동하고 갈 준비가입니다 ..

여기 nanotree 자바 스크립트를 다운로드할 수있는 링크는 ...
http://nanotree.sourceforge.net/~~V

적절 그래서 자바 스크립트와 이미지가 제대로로드 수 내 변수 {$ Site.framework_pub}을 바꿉니다.

또한주의하십시오, 나는 사용자 정의 디버그 vars를 처리하는 섹션에 추가했습니다 ... 내 디버그 구조는 '_user_debug'와 '_user_debug_key'라는

이 스레드에서이 모습을 구현하는 방법에 대한 자세한 내용은 :
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

당신이 관심이없는 그렇지 않으면, 그것은 템플릿에서 해당 부분을 제거하는 것이 안전합니다. 당신은 또한 제가 템플릿 VAR 섹션을 래핑하는 데 사용되는 {만약} 구문을 제거할 수 있습니다.

당신이 놀고 싶은 것 또 한가지는 디버그에 대한 값으로 출력이 얼마나 많은 자입니다. 이거보고 최대 문자 출력을 변경하는 두번째 숫자를 수정 : @ debug_print_var : 0:1000

제가 오른쪽 셀에 <h3> 위의 공간을 살거 왜 추신 : 아무도 알아낼 수 있습니까?

이게 도움이 되었으면 좋겠, 나는 그것을 좋아한다니까요 미소

PS 모든 자바 스크립트가 단지 "VAR mynanopath ="라인을 수정하고 공개 nanopath 디렉토리를 가리 키도록해야 제대로 작동 얻으려면. 당신의 nanotree 패키지 다운 가능 http://sourceforge.net/projects/nanotree/

여기 업데이트된 코드입니다

코드 :
{*
멋지 정의 DHTML 디버그 템플릿
@ 작성자 Hielke Hoeve
ideamesh 점 com>에서 @ 제작자 오웬 콜 <owenc
@ 2006년 2월 13일 멋지 2.6.12 이후
@ 패키지 멋지
@ 파일 이름 debug.tpl
*}

{assign_debug_info}

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

IF (self.name == ") {ldelim}
VAR 제목 = '콘솔';
{rdelim}
또 {ldelim}
VAR 제목 = 'Console_'+ self.name;
{rdelim}
_smarty_console = window.open ( "", title.value, "폭 = 800, 높이 = 600, 크기 조정, 스크롤바 = 예");
_smarty_console.document.write ( "<HTML> <HEAD> <TITLE> 멋지 디버그 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 사업부 {ldelim} 여백 왼쪽 : 10px; {rdelim} \ N");
_smarty_console.document.write ( "<\ / 스타일> \ N");
_smarty_console.document.write ( "<script language=\"Javascript\" src=\"" + mynanopath + "nanotree.js\"> <\ / 스크립트> \ N");
_smarty_console.document.write ( "<script type=\"text\/javascript\" language=\"JavaScript\"> \ N");
_smarty_console.document.write ( "<- \ N!");
_smarty_console.document.write ( "showRootNode = TRUE; \ N");
_smarty_console.document.write ( "sortNodes = 0; \ N");
_smarty_console.document.write ( "dragable = 거짓; \ N");
_smarty_console.document.write ( "showAllNodesOnStartup = TRUE; \ 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 + ' <\ / 사업부> '; \ 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 ({$ 카운터}, '멋지 디버그', helpIcon, '이것은 디버그 나무입니다 그것은 멋지 디버그 콘솔의 클래식 버전을 대체합니다.'); \ 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 ( "<\ \ / 테이블>");
_smarty_console.document.write ( ''); \ N ");

_smarty_console.document.write ( "rootNode.addChild (노드 {$ 카운터}); \ N");
{$ 카운터 + +}

{* 사용자 디버그 변수에 대한 노드를 만들기 *}
_smarty_console.document.write ( "VAR 노드 {$ 카운터} = 새 TreeNode ({$ 카운터} '사용자 디버그 변수 :'새 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 | 탈출 : 자바 스크립트 | 탈출 : 자바 스크립트} '); \ 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 ({$ 카운터} ', 할당된 템플릿 변수 :'새 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 | 탈출 : 자바 스크립트 | 탈출 : 자바 스크립트} '); \ 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 ({$ 카운터} 'config 파일 변수 (외부 템플릿 범위) 할당', 새로운 배열 (closedGif, openGif)); \ N");
_smarty_console.document.write ( "rootNode.addChild (노드 {$ 카운터}); \ N");
_smarty_console.document.write ( "VAR 부모 노드 = {$ 카운터}; \ N");
{$ 카운터 + +}

{* 잘난척 쟁이 최선을 구성 파일 변수에 자식 노드 만들기 *}
{섹션 이름 = 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 | 탈출 : 자바 스크립트 | 탈출 : 자바 스크립트} '); \ 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 ( "<\ / 스크립트> \ N \ N");
_smarty_console.document.write ( "<\ / HEAD> <body onload=\"init()\"> \ N");
_smarty_console.document.write ( "<h3> 멋지 & 사용자 디버그 콘솔 <\ / 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'> & <\ / 사업부> <\ / 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 급식 | 코멘트 남기기 | 트랙백 URL을

당신의 코멘트를 남겨주세요

© 2008-2012 - 판권 소유 - Ideamesh 주식 회사 22 쿼리. 0.599 초.