Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

{eval}

{eval}鍙互鎵ц鍙橀噺鏄剧ず銆傚畠鍙敤浜庢墽琛屾ā鏉垮彉閲忎腑鐨勬爣绛/鍙橀噺锛 鎴栬呮潵鑷簬閰嶇疆鏂囦欢鐨勬爣绛/鍙橀噺銆

濡傛灉浣犳彁渚涗簡assign 灞炴э紝 {eval}鍑芥暟鐨勮緭鍑哄皢涓嶄細鏄剧ず锛岃屾槸璧嬪肩粰妯℃澘鍙橀噺銆

鍙傛暟鍚嶇О 绫诲瀷 蹇呴夊弬鏁 榛樿鍊 璇存槑
var mixed Yes n/a 闇瑕佹墽琛岀殑鍙橀噺鎴栧瓧绗︿覆
assign string No n/a 鐢ㄤ簬璧嬪肩殑鍙橀噺鍚

鎶鏈鏄

  • 鎵ц鍙橀噺鐨勬柟寮忓拰鎵ц妯℃澘涓鏍凤紝浣跨敤涓庢ā鏉跨浉鍚岀殑瑙f瀽鏂瑰紡鍜屽畨鍏ㄦ満鍒躲

  • 鎵ц鍙橀噺鐨勬搷浣滃皢鍦ㄦ瘡娆$紪璇戠殑鏃跺欓兘浼氬惎鍔紝缂栬瘧鐗堟湰鐨勭▼搴忎笉浼氳淇濆瓨锛 鐒惰屽鏋滀綘寮鍚簡缂撳瓨璁剧疆锛岄偅涔 妯℃澘鐨勫叾浣欓儴鍒嗕細琚紦瀛樸

  • 濡傛灉鎵ц鐨勫唴瀹逛笉浼氱粡甯稿彉鍖栵紝鎴栬呰澶氭浣跨敤锛屽彲浠ヨ冭檻浣跨敤 {include file="string:{$template_code}"}鏉ヤ唬鏇裤 杩欏彲浠ュ湪缂栬瘧鍚庤缂撳瓨锛堥熷害鏇村揩锛夛紝鑰屼笖涔熶笉浼氭瘡娆$紪璇戦兘鎵ц銆

Example聽8.3.聽{eval}

杩欓噷鏈変釜閰嶇疆鏂囦欢锛setup.conf.


emphstart = <strong>
emphend = </strong>
title = Welcome to {$company}'s home page!
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
ErrorState = You must supply a {#emphstart#}state{#emphend#}.

  

妯℃澘锛


{config_load file='setup.conf'}

{eval var=$foo}
{eval var=#title#}
{eval var=#ErrorCity#}
{eval var=#ErrorState# assign='state_error'}
{$state_error}

  

灏嗚緭鍑猴細


This is the contents of foo.
Welcome to Foobar Pub & Grill's home page!
You must supply a <strong>city</strong>.
You must supply a <strong>state</strong>.

  

Example聽8.4.聽鍙︿竴涓獅eval}渚嬪瓙

渚嬪瓙灏嗘樉绀烘湇鍔″櫒鍚嶇О锛堝ぇ鍐欏瓧姣嶏級鍜孖P銆 璧嬪肩殑$str鍙互鏄潵鑷簬鏁版嵁搴撶殑鏌ヨ銆

 
<?php
$str = 'The server name is {$smarty.server.SERVER_NAME|upper} '
       .'at {$smarty.server.SERVER_ADDR}';
$smarty->assign('foo',$str);
?>
 
   

妯℃澘鏄細

 
    {eval var=$foo}
 
   

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 0 plus 4? (Are you human?)

Advertisement