PHP Template

Reviews
Shared by: moneu
Stats
views:
412
rating:
not rated
reviews:
0
posted:
11/16/2008
language:
pages:
0
PHP Template 工讀生 機械所 劉立業 Outline Web Template Web Template Classification Introduction to Smarty Smarty Usage Smarty Example References Web Template Separate content from presentation on the web design. Suitable for websites often require regular content updates, and standardization of appearance. *Picture refer from wikipedia Web Template Classification (1/3) Static web template (Outside server template system architecture) e.g. Dreamweaver, FrontPage *Picture refer from wikipedia Web Template Classification (2/3) Server-side web template (Server-side template system architecture) e.g. SSI(Server Side Includes),Smarty base: ASP,JSP,PHP,Perl *Picture refer from wikipedia Web Template Classification (3/3) Client-side web template (Distributed template system architecture) e.g. Ajax,RIA *Picture refer from wikipedia (Rich Internet application: JavaScript,Flash Player,ActiveX Controls,Java applets,SVG) Introduction to Smarty  Smarty is a server-side template system.  Separate application logic and business logic from presentation logic – Designers can't break application code, and the code will be tighter, more secure and easier to maintain. – Errors in the templates are as simple and intuitive as possible for the designer. – Designers can modify or completely redesign without intervention from the programmer. – Programmers can maintain the application code without disturbing the presentation layer. Smarty Usage (1/2)  Step 1. 載入 Smarty 樣版引擎     include "Smarty.class.php"; Step 2. 建立 Smarty 物件 $tpl = new Smarty(); Step 3. 設定 Smarty 物件的參數 $tpl->template_dir = “xxx”; $tpl->compile_dir (此目錄屬性須設定為777或去除唯讀) $tpl->config_dir $tpl->cache_dir Step 4. 在程式中處理變數後,再用 Smarty 的 assign 方法將變數 置入樣版裡 $tpl->assign(“變數名稱”, 值); Step 5. 利用 Smarty 的 display 方法將網頁秀出 $tpl->display('test.tpl'); Smarty Usage (2/2) template_dir = __SITE_ROOT . "/templates/"; $tpl->compile_dir = __SITE_ROOT . "/templates_c/"; $tpl->config_dir = __SITE_ROOT . "/configs/"; $tpl->cache_dir = __SITE_ROOT . "/cache/"; ?> Smarty Example (1/3) {$title} {$content} Smarty Example (2/3) assign("title", "測試用的網頁標題"); $tpl->assign("content", "測試用的網頁內容"); $tpl->display('test.tpl'); ?> Smarty Example (3/3) templates_c/%%179/%%1798044067/test.tpl.php: <?php echo $this->_tpl_vars['title']; ?> _tpl_vars['content']; ?> References  Wikipedia (List Keyword Only) – – – – Web template Web template system Template engine Rich Internet application  Smarty Home – http://smarty.php.net/  Smarty入門(中文) – http://www.php5.idv.tw/documents/smarty/smarty20040209.htm  SmartyWiki – http://smarty.incutio.com/

Related docs
SQLite and PHP
Views: 156  |  Downloads: 31
Php
Views: 65  |  Downloads: 11
Smarty - the compiling PHP template engine
Views: 22  |  Downloads: 4
CodingStandards for php
Views: 354  |  Downloads: 5
Advanced PHP
Views: 0  |  Downloads: 0
php analogy
Views: 204  |  Downloads: 7
Seminar on PHP (introducing PHP)
Views: 313  |  Downloads: 18
MVC-with-PHP
Views: 96  |  Downloads: 18
PHP SpeedBerg Templates EPFL PHP
Views: 2  |  Downloads: 0
Pemrograman PHP dengan Smarty Template
Views: 755  |  Downloads: 75
Advanced PHP Training
Views: 42  |  Downloads: 5
Other docs by moneu
Surrender of Japan info
Views: 183  |  Downloads: 0
RESIGNATION
Views: 447  |  Downloads: 8
meditationforhealthpurposes
Views: 198  |  Downloads: 2
Transcript of Gettysburg Address
Views: 281  |  Downloads: 2
Promissory Note for Business Loan Amortized Pmts
Views: 235  |  Downloads: 7
Net lease
Views: 338  |  Downloads: 4
Bill of Rights info
Views: 258  |  Downloads: 2
Sample_Press_Release
Views: 662  |  Downloads: 16
Petition to cancel registration
Views: 199  |  Downloads: 1
long_distance_call_log
Views: 287  |  Downloads: 11
Minutes of Shareholders Meeting
Views: 284  |  Downloads: 7
FORM CONSULTING AGREEMENT
Views: 2054  |  Downloads: 212