Şubat
13
2006

Nasıl Smarty: Javascript Debug Şablon

GÜNCELLEME: Bir karşıdan yükleme paketi burada mevcuttur: http://ideamesh.com/file/11/Smarty-Debug-with-Collapsible-Variables.html

İşte değiştirilmiş kod çalışma ve gitmek için hazır olduğunu ..

Burada nanotree javascript indirebilirsiniz link ...
http://nanotree.sourceforge.net/~~V

Uygun şekilde javascript ve görüntüleri doğru yüklenebilir benim değişken {$ Site.framework_pub} değiştirin.

Ayrıca unutmayın, ben kullanıcı tanımlı hata ayıklama vars işlemek için bir bölümünde ekledim ... Benim hata ayıklama yapı '_user_debug' ve '_user_debug_key' adlı

Bu konuya bu bakış nasıl uygulanacağı konusunda daha fazla bilgi için:
http://www.smarty.net/forums/viewtopic.php?p=31241 # 31241

Eğer ilgilenmiyorsanız Aksi takdirde, bu şablondan o bölüm kaldırmak için güvenlidir. Ayrıca ben şablonu var bölümüne kaydırmak için kullanılan {} if deyimi kaldırmak olabilir.

Eğer oynamak isteyebilirsiniz başka bir şey hata ayıklama için değer olarak çıktı kaç karakterdir. Bu arayın ve maksimum karakter çıkış değiştirmek için ikinci sayıyı değiştirin: @ debug_print_var: 0:1000

Ben sağ hücreye <h3> üzerinde bir boşluk alıyorum neden PS herkes anlamaya miyim?

Umarım yardımcı olmuştur, ben bunu seviyorum biliyor Gülümseme

PS, tüm javascript sadece "var mynanopath =" satırı değiştirin ve sizin kamusal nanopath dizinine işaret emin olmak gerekir düzgün çalışmıyor almak için. Sizden nanotree Paketi yere can http://sourceforge.net/projects/nanotree/

İşte güncellenen kod

Kod:
{*
Smarty Özel DHTML Debug Şablon
@ Yazar Hielke Hoeve
Ideamesh nokta com> az @ yazarı Owen Cole <owenc
@ 2006/02/13 Smarty 2.6.12 beri
@ Paket Smarty
@ Dosya debug.tpl
*}

{Assign_debug_info}

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

if (self.name == ") {} ldelim
var title = 'Console';
{Rdelim}
else {ldelim}
var title = 'Console_' + self.name;
{Rdelim}
_smarty_console = window.open ("", title.value, "width = 800, height = 600, resizable, scrollbars = yes");
_smarty_console.document.write ("<html> <head> Smarty Debug Console_" + self.name + "<\ / title> \ 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 ("# debugtreetable ldelim} {width: 100%;} {rdelim \ n");
_smarty_console.document.write ("# debugtreetable td ldelim} {border: ince düz siyah; rdelim {} \ n");
_smarty_console.document.write ("# debugtreetextdiv div ldelim} {padding-left: 10px; rdelim {} \ 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 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 = false; \ n");
_smarty_console.document.write ("showAllNodesOnStartup = true; \ n");

_smarty_console.document.write ("\ / ** \ n");
_smarty_console.document.write ("* ağaç başlatmak için gerekli \ n.");
_smarty_console.document.write ("* Ve showTree (ImagePath) aramak için;. aslında ağacı göstermek için \ n");
_smarty_console.document.write ("* Alternatif olarak, bu sayfanın alt kısmında bir komut dosyası bloğu yapılabilir \ n.");
_smarty_console.document.write ("Bu yöntem biraz temizleyici * rağmen \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("init function () {ldelim} \ n");
_smarty_console.document.write ("kapsayıcı = 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 ("bir kullanıcı bir düğüm tıkladığında Denir * \ n.");
_smarty_console.document.write ("* @ param TreeNode tıklanan edilmiştir TreeNode nesnesi \ n.");
_smarty_console.document.write ("* \ / \ n");
_smarty_console.document.write ("fonksiyonu 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 + ' <\ / span> '; \ n ");
_smarty_console.document.write ("{rdelim} \ n");

_smarty_console.document.write ("fonksiyonu nodeEdited (TreeNode) {ldelim} \ n");
_smarty_console.document.write ("{rdelim} \ 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 pageIcon = '" + mynanopath + "images \ / sayfa 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");

{* Temel düğüm oluşturun *}
{Atamak var = sayaç değeri = 0}
_smarty_console.document.write ("rootNode = new TreeNode ({$ sayaç}, 'Smarty Debug', helpIcon, 'Bu hata ayıklama Ağacı Bu Smarty Debug Konsolu klasik sürümünün yerini alır.'); \ n");
{$ Sayac + +}

{Şablon oluşturma * düğümü * içerir}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'şablonlar ve config dosyalarını (saniye yükleme süresi) dahil:', pageIcon, '");
_smarty_console.document.write ("<table width=\"100%\">");
{Bölüm adı = şablonları loop = $ _debug_tpls}
_smarty_console.document.write ("<tr bgcolor={if %templates.index% even}#eeeeee{else}#fafafa{/if}> <td colspan=2> <tt> {bölüm adının = girinti loop = $ _debug_tpls [templates]. derinliği &&&} {/ section} <font color = {if $ _debug_tpls [templates]. tip eq "şablon" kahverengi {} elseif $ _debug_tpls [templates]. tip eq isset ($ _debug_tpls [templates] exec_time.)} <font size=-1> <i> ({$ _debug_tpls [templates] exec_time | string_format:. "% .5 f"}) {% templates.index% eq 0 ise} (toplam) {/ if} <\ \ / i> <\ \ / font> {/ if} <\ \ / tt> <\ \ / td> <\ \ / tr> ");
{Sectionelse}
_smarty_console.document.write ("<tr> bgcolor=#eeeeee> <td colspan=2> <tt> <i> hiçbir şablonları <\ \ / i> <\ \ / tt> <\ \ / td> <\ \ dahil / tr> ');
{/ Section}
_smarty_console.document.write ("<\ \ / table>");
_smarty_console.document.write ("'); \ n");

_smarty_console.document.write ("rootNode.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}

{* Kullanıcı hata ayıklama değişkenler için düğüm oluşturma *}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'kullanıcı hata ayıklama değişkenleri:' new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (düğüm {$ sayaç}); \ n");
_smarty_console.document.write ("var veli = düğümü {$ sayac;} \ n");
{$ Sayac + +}

{* Kullanıcı hata ayıklama değişkenler için alt düğümleri oluşturma *}
{Bölüm adı = vars loop = $ _user_debug}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, '{ldelim} $ {$ _user_debug_key [değişkenler]} {rdelim}', pageIcon, '{$ _user_debug [değişkenler] | @ debug_print_var: 0:1000 | kaçış: javascript | kaçış: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{Sectionelse}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'Hat yok Kullanıcı Debug Bilgileri', HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{/ Section}

{* Şablon değişkenlerini * için düğüm oluşturma}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'atanmış şablon değişkenleri:' new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (düğüm {$ sayaç}); \ n");
_smarty_console.document.write ("var veli = düğümü {$ sayac;} \ n");
{$ Sayac + +}

{* Şablon değişkenleri alt düğümleri oluşturma *}
{Bölüm adı = vars loop = $ _debug_keys}
{If $ _debug_keys [değişkenler]! = '_user_debug' && $ _debug_keys [Değişkenler]! = '_user_debug_key'}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, '{ldelim} $ {$ _debug_keys [değişkenler]} {rdelim}', pageIcon, '{$ _debug_vals [değişkenler] | @ debug_print_var: 0:1000 | kaçış: javascript | kaçış: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{/ If}
{Sectionelse}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'Şablon atanmamış değişkenler', HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{/ Section}

{Smarty config dosyası değişkenleri oluşturun * düğümü *}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'config dosyası değişkenleri (dış şablon kapsam) atanmış:' new Array (closedGif, openGif)); \ n");
_smarty_console.document.write ("rootNode.addChild (düğüm {$ sayaç}); \ n");
_smarty_console.document.write ("var veli = düğümü {$ sayac;} \ n");
{$ Sayac + +}

{* Smarty config dosyası değişkenleri alt düğümleri oluşturma *}
{Bölüm adı = config_vars loop = $ _debug_config_keys}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, '{ldelim} $ {$ _debug_config_keys [config_vars]} {rdelim}', pageIcon, '{$ _debug_config_vals [config_vars] | @ debug_print_var: 0:1000 | kaçış: javascript | kaçış: javascript} '); \ n ");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{Sectionelse}
_smarty_console.document.write ("var düğümü {$ sayaç} = new TreeNode ({$ sayaç}, 'Hat yok yapılandırma değişkenleri', HelpIcon); \ n");
_smarty_console.document.write ("parent.addChild (düğüm {$ sayaç}); \ n");
{$ Sayac + +}
{/ Section}

_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 & Kullanıcı Debug Konsolu <\ / h3>");
_smarty_console.document.write ("sağ panelinde görüntülenen içerikleri için ağaç değişkenlere <h4> tıklayın <\ / h4>.");
_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 ("<td valign='top'> <div id='debugtreetextdiv'> & <\ / td>");
_smarty_console.document.write ("<\ / tr> <\ / table>");
_smarty_console.document.write ("<\ / body> <\ / html>");
() _smarty_console.document.close;
</ Script>

etiketler: ,
posted Rehberleri , Programlama Owen tarafından

Comments via izleyin RSS | Leave a comment | Trackback URL

Sizin Yorum Yaz

 
© 2008 - 2012 - Tüm Hakları Saklıdır - Ideamesh, Inc 22 sorgu. 0.381 saniye.