锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久无码精品亚洲日韩蜜臀浪潮 ,亚洲av之男人的天堂网站,亚洲人成777在线播放http://www.tkk7.com/jrobot/category/2760.htmljava鐩稿叧鎶鏈?eclipse,swt,jfacezh-cnFri, 02 Mar 2007 06:39:40 GMTFri, 02 Mar 2007 06:39:40 GMT60SmartTemplate瀛︿範絎旇http://www.tkk7.com/JRobot/articles/10181.htmlJRobotJRobotMon, 15 Aug 2005 16:26:00 GMThttp://www.tkk7.com/JRobot/articles/10181.htmlhttp://www.tkk7.com/JRobot/comments/10181.htmlhttp://www.tkk7.com/JRobot/articles/10181.html#Feedback0http://www.tkk7.com/JRobot/comments/commentRss/10181.htmlhttp://www.tkk7.com/JRobot/services/trackbacks/10181.html鐩綍
1銆丼martTemplate鐨勬晥鐜?
2銆佸熀鏈彉閲?
3銆侀昏緫榪愮畻緇撴瀯
4銆佹ā寮忥紙Methods錛?
5銆佹墿灞曠被(Extensions) 鏈畬鎴?
------------------------------------------------------------------------
1銆丼martTemplate鐨勬晥鐜?
铏界劧浠栨湁寰堝鐨勭▼搴忔潵褰㈡垚寮哄ぇ鐨勫姛鑳斤紝浣嗗湪鎵ц鏃跺彧鏈変綘璋冪敤鐨勬墠琚鍏ワ紝鎵浠ヤ笉鐢ㄦ媴蹇冭繖鏂歸潰鐨勯熷害褰卞搷錛屽悓鏍瘋繖濂楁ā鐗堢郴緇熸槸涓烘渶蹇殑鎵ц鏁堢巼鑰屼紭鍖栬繃鐨勶紝姣旇搗鐩墠甯傚満涓婂父瑙佺殑Smarty錛岃蹇笉灝戯紙Smarty閲囩敤鍚庢湡緙撳瓨錛屾墍浠ユ瘮杈冨彲鑳戒笉鏄緢鍑嗙‘錛夈?

 

2銆丼martTemplate鐨勫彉閲?
Array鐨勫彉閲忔槸鐢盨martTemplate鍐呭緩鍑芥暟assign錛堬級鏉ヨ祴鍊肩殑
鍏蜂綋璇硶濡備笅

code:
assign ( 妯$増涓殑鍙橀噺, 瑕佹浛鎹㈢殑鍐呭 )

鎴?

code:
assign ( Array鍐呭 )

姝e鍏朵粬紼嬪簭鐨勫彉閲忎竴鏍鳳紝smartTemplate鐨勫彉閲忔槸鐢辯壒孌婄殑{}鎵鍖呭惈鐨勩傞噷闈㈢殑鍐呭鍙互鏄疭tring錛孉rray錛孖nt錛屾垨鑰呮槸Long Text絳夌瓑錛堝熀鏈笂php鏀寔鐨勶級
鍦ㄥ偍瀛楢rray鏁版嵁鏃訛紝smartTemplate榪愮敤浜嗘垜浠父瑙佺殑鐖跺瓙綰у垎鍓茬"."錛屾墍浠ヤ竴涓壒孌婄殑Array鏁版嵁鐢盇rray Handle鍜屽叿浣撲綅緗殑绱㈠紩緇勬垚(Numerical Index or Associative Index)銆?
涓嬮潰鏄竴涓緥瀛?
鍦╬hp鐜涓嬭繍琛屼互涓嬬▼搴?

code:
<?php
   $template  =  new SmartTemplate('template.html');
   $text  =  'Sample Text';
   $template->assign( 'TITLE', $text );
   $template->output();
?>

妯$増

code:
<html> {TITLE} </html>

杈撳嚭

code:
<html> Sample Text </html>

鍦ㄥ彧鏈変竴涓狝rray鐨勬儏鍐典笅錛屽彲浠ョ洿鎺ョ渷鐣ュ墠闈㈢殑array handle,灝辮薄鍦ㄤ嬌鐢╦avascript鏃訛紝document.window.close()鍙互鐪佺暐涓簑indow.close()

code:
<?php
   $user  =  array(
                'NAME'  => 'John Doe',
                'GROUP' => 'Admin',
                'AGE'   => '42',
             );
   $template  =  new SmartTemplate('user.html');
   $template->assign( $user );
   $template->output();
?>

妯$増

code:
Name:  {NAME}
Group: {GROUP}
Age:   {AGE}
杈撳嚭
CODE 
Name:  John Doe
Group: Admin
Age:   42


涓嬮潰鏄彟澶栦竴涓緥瀛愩備嬌鐢ㄤ簡SmartTemplate鐨勫驚鐜嚱鏁?lt;!-- begin Array鍚?-->XXXXXX<!-- end Array鍚?gt;
浠栫殑鍔熻兘綾諱技foreach()錛屽彧瑕佹湁涓滆タ錛屽氨涓鐩村驚鐜樉紺?

code:
<?php
   $links  =  array(
                  array(
                      'TITLE' => 'PHP',
                      'URL'   => 'http://www.php.net/',
                  ),
                  array(
                      'TITLE' => 'Apache',
                      'URL'   => 'http://www.php.net/',
                  ),
                  array(
                      'TITLE' => 'MySQL',
                      'URL'   => 'http://www.mysql.com/',
                  ),
              );
   $template  =  new SmartTemplate('links.html');
   $template->assign( 'links', $links );
   $template->output();
?>

HTML妯$増

code:
<html>
<h3> Sample Links </h3>
<!-- BEGIN links -->
   <a href="../{URL}"> {TITLE} </a>
<!-- END links -->
</html>
CODE 
<html>
<h3> Sample Links </h3>
   <a href="../   <a href="../   <a href="../</html>

3銆丼martTemplate鐨勯昏緫鎺у埗緇撴瀯
鈽匢f鍜宔nd If
璇硶錛?
<!-- IF 鍙橀噺 --> 鍙橀噺宸茶璧嬪鹼紒 <!-- ENDIF 鍙橀噺 -->
濡傛灉IF鍚庨潰鐩存帴璺熷彉閲忥紝鍙橀噺涓篘ull鏃朵細榪斿洖0,鍚﹀垯榪斿洖1
<!-- IF name=="John Doe" --> Your name is John Doe! <!-- ENDIF name -->
==鍒ゆ柇鏄惁鐩哥瓑錛屽鏋滅浉絳夎繑鍥?錛屼笉鐩哥瓑榪斿洖0
<!-- IF name!="John Doe" --> Your name is not John Doe! <!-- ENDIF name -->
!=鍒ゆ柇鏄惁涓嶇瓑錛屽鏋滄垚绔嬭繑鍥?,鐩哥瓑鍒欒繑鍥?
渚嬪瓙錛?

code:
<?php
   require_once "class.smarttemplate.php";
   $page = new SmartTemplate("if.html");
   $page->assign( 'username',   'John Doe' );
   $page->assign( 'usergroup',  'ADMIN' );
   $page->assign( 'picture',    '' );
   $page->output();
?> 

HTML

code:
<!-- IF username --> <H3> Welcome, {username} </H3> <!-- ENDIF -->
<!-- IF picture --> <img src="{picture}"> <!-- ENDIF picture -->
<!-- IF usergroup="ADMIN" -->
<a href="../admin.php"> ADMIN Login </a><br>
<!-- ENDIF usergroup -->

杈撳嚭

code:
<H3> Welcome, John Doe </H3>
<a href="../admin.php"> ADMIN Login </a><br>

鈽匢F鐨勫瓙灞 else
濡傛灉else瀛愬彞鍑虹幇鍦ㄤ竴涓昏緫寰幆涓紝褰搃f鐨勬潯浠朵笉鎴愮珛鏃跺垯浼氳榪愯銆?
渚嬪瓙

code:
<?php
   require_once "class.smarttemplate.php";
   $page = new SmartTemplate("else.html");
   $page->assign( 'username',   'John Doe' );
   $page->assign( 'usergroup',  'ADMIN' );
   $page->assign( 'picture',    '' );
   $page->output();
?> 

妯$増

code:
<!-- IF username -->
<H3> Welcome, {username} </H3>
<!-- ENDIF -->
<!-- IF picture -->
<img src="{picture}">
<!-- ELSE -->
Picture not available! <br>
<!-- ENDIF picture -->
<!-- IF usergroup="ADMIN" -->
<a href="../admin.php"> ADMIN Login </a><br>
<!-- ELSE -->
You are in guest mode!
<!-- ENDIF usergroup -->

杈撳嚭

code:
<H3> Welcome, John Doe </H3>
Picture not available! <br>
<a href="../admin.php"> ADMIN Login </a><br>

鈽卐lseif
elseif鏄痚lse鍜宨f緇勫悎璧鋒潵鐨勪竴縐嶇粨鏋?鍏舵剰涔変負"闄ゆ涔嬪濡傛灉..."
浠ヤ笅鏄竴涓緥瀛?

code:
<?php
   require_once "class.smarttemplate.php";
   $page = new SmartTemplate("elseif.html");
   $page->assign( 'usergroup',  'INTERNAL' );
   $page->output();
?> 

妯$増鏂囦歡

code:
<!-- IF usergroup="ADMIN" -->
<a href="../admin.php"> 綆$悊鍛樼櫥闄?</a><br>
<!-- ELSEIF usergroup="SUPPORT" -->
<a href="../support.php"> 甯姪浜哄憳鐧婚檰</a><br>
<!-- ELSEIF usergroup -->
<a href="../other.php"> 鏅氭柟寮忕櫥闄?</a><br>
<!-- ELSE -->
You don't even have a usergroup!
<!-- ENDIF -->

榪愯php寰楀埌鐨勮緭鍑?

code:
<a href="../other.php"> 鏅氭柟寮忕櫥闄?</a><br>

鈽匓egin...End
榪? 涓鍙ョ敤浜庤鍙栦竴涓暣鏁扮儲寮曠煩闃?Numerical Array,浠ユ暟瀛椾負绱㈠紩鐨勬暟緇?鐨勫?鑰屾瘡涓暣鏁扮煩闃電殑瀛愮煩闃靛垯鎴愪負浠ュ瓧絎︿覆涓虹儲寮曠殑鐭╅樀(Associative Array)鐒跺悗鍦?lt;!-- begin --> 鍜?<!-- end -->涔嬮棿鐨勮鍙ュ皢浼氳璇誨彇騫朵笖閲嶅鎵ц.
闄勫姞:,姣忎釜associative array(瀛楃涓蹭負绱㈠紩鐨勭煩闃?浼氭湁涓や釜闄勫姞鐨勫?
ROWCNT : 姝ゅ厓绱犲湪鐖剁煩闃典腑鐨勫叿浣撲綅緗?(0,1,2,3,...n) (灝辨槸鐩墠鍦ㄧ鍑犱釜鐭╅樀)
ROWBIT : 鐭╅樀搴忓彿鐨勬渶鍚庝竴浣? (0,1,0,1,0,1,...)
涓嬮潰鏄竴涓緥瀛?
PHP浠g爜:

code:
<?php
   require_once "class.smarttemplate.php";
   $page = new SmartTemplate("begin_end.html");
   $users = array(
              array( 'NAME' => 'John Doe',   'GROUP' => 'ADMIN' ),
              array( 'NAME' => 'Jack Doe',   'GROUP' => 'SUPPORT' ),
              array( 'NAME' => 'James Doe',  'GROUP' => 'GUEST' ),
              array( 'NAME' => 'Jane Doe',   'GROUP' => 'GUEST' ),
            );
   $page->assign( 'users',  $users );
   $page->output();
?>

HTML妯$増

code:
<style type="text/css">
.col0 { background-color: #D0D0D0; }
.col1 { background-color: #F0F0F0; }
</style>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th> No </th>
<th> Username </th>
<th> Usergroup </th>
</tr>
<!-- BEGIN users -->
<tr class="col{ROWBIT}">
<td> {ROWCNT} </td>
<td> {NAME} </td>
<td> {GROUP} </td>
</tr>
<!-- END users -->
</table>

鏈鍚庣殑杈撳嚭

code:
<style type="text/css">
.col0 { background-color: #D0D0D0; }
.col1 { background-color: #F0F0F0; }
</style>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th> No </th>
<th> Username </th>
<th> Usergroup </th>
</tr>
<tr class="col0">
<td> 0 </td>
<td> John Doe </td>
<td> ADMIN </td>
</tr>
<tr class="col1">
<td> 1 </td>
<td> Jack Doe </td>
<td> SUPPORT </td>
</tr>
<tr class="col0">
<td> 2 </td>
<td> James Doe </td>
<td> GUEST </td>
</tr>
<tr class="col1">
<td> 3 </td>
<td> Jane Doe </td>
<td> GUEST </td>
</tr>
</table>

鈽唖martTemplate鐨勬柟娉?
娉?浠ヤ笅鍒楀嚭鐨勬柟娉曞茍涓嶄細鍦ㄦā鐗堣璁′腑鍑哄墠錛屼粬浠睘浜巗martTemplate鐨勪唬鐮佺紪杈戦儴鍒?浣嗘槸濡傛灉涓轟簡瀹炵幇鏇存繁涓姝ョ殑妯$増璁捐,涓嬮潰鐨勫唴瀹規槸鑲畾鏈夌敤鐨?
鈽呭熀紜鏂規硶:assign (涓枃鎰忔?璧嬪?
璇硶:
assign ( 鍙橀噺鍚? 娣峰悎鍐呭 )
鎴栬?
assign ( 鐭╅樀鍙橀噺 )
鏇村浠嬬粛鍦ㄥ彉閲忎粙緇嶉儴鍒?
鈽匒ppend(闄勫姞)
璇硶:append ( 鍙橀噺鍚? 鍐呭 )
瀵規墍鎻愪緵鐨勫彉閲忛檮鍔犳彁渚涚殑鍐呭
渚嬪瓙:

code:
<?php
   $page  =  new SmartTemplate('links.html');
   $page->append('links' => array(
                                'TITLE' => 'PHP',
                                'URL'   => 'http://www.php.net/'
                            ));
   $page->append('links' => array(
                                'TITLE' => 'Apache',
                                'URL'   => 'http://www.apache.org/'
                            ));
   $page->append('links' => array(
                                'TITLE' => 'MySQL',
                                'URL'   => 'http://www.mysql.com/'
                            ));
   $page->output();
?>

妯$増

code:
<html>
<h3> Sample Links </h3>
<!-- BEGIN links -->
   <a href="../{URL}"> {TITLE} </a>
<!-- END links -->
</html>

鏈緇堣緭鍑?

code:
<html>
<h3> Sample Links </h3>
   <a href="../http://www.php.net/"> PHP </a>
   <a href="../http://www.apache.org/"> Apache </a>
   <a href="../http://www.mysql.com/"> MySQL </a>
</html>

鍙﹀涓涓檮鍔犲瓧絎︿覆鐨勪緥瀛?

code:
<?php
   $page  =  new SmartTemplate('template.html');
   $page->append('TITLE' => 'Hello ');
   $page->append('TITLE' => 'World ');
   $page->append('TITLE' => '!');
   $page->output();
?>

杈撳嚭灝嗕細寰楀埌

code:
<html> Hello World ! </html>

JRobot 2005-08-16 00:26 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 全黄性性激高免费视频| 91在线视频免费91| ZZIJZZIJ亚洲日本少妇JIZJIZ| 久久久久亚洲av毛片大| 人成免费在线视频| 中文字幕亚洲日韩无线码| 色多多www视频在线观看免费| 永久免费AV无码网站在线观看| 中文字幕亚洲码在线| 韩国欧洲一级毛片免费| 一本色道久久88—综合亚洲精品| 亚洲大片免费观看| 亚洲xxxxxx| 日本久久久免费高清| 国产精品亚洲综合一区在线观看| 韩国日本好看电影免费看| 美女羞羞喷液视频免费| 中文字幕亚洲一区二区三区| 国产成人无码区免费内射一片色欲| 国产无遮挡吃胸膜奶免费看视频| 18禁亚洲深夜福利人口| 久久久久亚洲精品男人的天堂 | 又爽又黄无遮挡高清免费视频 | 免费福利资源站在线视频| 亚洲中文字幕无码专区| 久久免费视频精品| 亚洲国产情侣一区二区三区| 麻豆国产VA免费精品高清在线| 亚洲а∨精品天堂在线| 亚洲熟女一区二区三区| 亚洲视频在线免费看| 男人的天堂av亚洲一区2区| 久久影视国产亚洲| 美丽的姑娘免费观看在线播放| 亚洲国产中文在线视频| 免费久久精品国产片香蕉| 久久免费看少妇高潮V片特黄| 亚洲精品国产福利片| 免费中文字幕一级毛片| 91视频免费网址| 曰批免费视频播放在线看片二|