There is a debugging console included with Smarty. The console informs you of all the included templates, assigned variables and config file variables for the current invocation of the template. A template named "debug.tpl" is included with the distribution of Smarty which controls the formatting of the console. Set $debugging to true in Smarty, and if needed set $debug_tpl to the template resource path for debug.tpl (this is in SMARTY_DIR by default.) When you load the page, a javascript console window should pop up and give you the names of all the included templates and assigned variables for the current page. To see the available variables for a particular templates, see the {debug} template function. To disable the debugging console, set $debugging to false. You can also temporarily turn on the debugging console by putting SMARTY_DEBUG in the URL if you enable this option with $debugging_ctrl.
在 Smarty 中有包含一個除錯控制台,此一控制台可以告知你在現在所使用的樣版中有 包含到哪些樣版、指定的變數值、與組態檔變數,在 Smarty 的發佈軟體中會包含一個名稱為 "debug.tpl" 的檔案,其功能在控制台的格式化方式。在 Smarty 中如果將 $debugging 設為 true 的話,則還需要將 $debug_tpl 設定到 debug.tpl 檔案的位置(預設是在 SMARTY_DIR 設定的路徑中)。當你讀入網頁檔案時,視窗會跳出一個 javascript 控制台網頁,且告訴你現 在網頁所包含樣版檔案與指定變數的名稱。想知道某些樣版檔案包含哪些變數的話,請參考 {debug} 樣版函式。如果想關掉除錯控制台的話,將 $debugging 設為 false。你也可以 URL 放到 SMARTY_DEBUG 設定中以暫時打開除錯控制台,但是必須將 $debugging_ctrl 設定為 true。
Technical Note: The debugging console does not work when you use the fetch() API, only when using display(). It is a set of javascript statements added to the very bottom of the generated template. If you do not like javascript, you can edit the debug.tpl template to format the output however you like. Debug data is not cached and debug.tpl info is not included in the output of the debug console.
技術提醒: 如果你使用 fetch() API 的話除錯控制台將不會有所動作,而只有在使用 display() 函式 時控制台才會有所紀錄,display() 會使用 javascript 陳述式將所產生的樣版產生在檔案的最 下面。如果你不喜歡 javascript,你可以編輯 debug.tpl 樣版檔將輸出的形式設定成你想要的 格式。除錯資料不會被快取住,且 debug.tpl 的資料不會被包含在除錯控制台的輸出之中。
Note: The load times of each template and config file are in seconds, or fractions thereof.
提醒: 樣版與組態檔案載入的時間是以秒為單位計算,或是更小。