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

{capture}

{capture}鍙互鎹曡幏鏍囪鑼冨洿鍐呯殑杈撳嚭鍐呭锛屽瓨鍒板彉閲忎腑鑰屼笉鏄剧ず銆 浠讳綍鍦{capture name='foo'}{/capture} 涔嬮棿鐨勫唴瀹归兘浼氳鎹曡幏鍒板彉閲忥紝鍙橀噺鍚嶅彲浠ラ氳繃name灞炴ф潵鎸囧畾銆

鎹曡幏鐨勫唴瀹瑰彲浠ラ氳繃$smarty.capture.foo鍙橀噺鏉ヤ娇鐢紝杩欓噷foo鏄缃殑name灞炴с 濡傛灉娌℃湁鎻愪緵name灞炴э紝榛樿鏄default锛屼篃灏辨槸 $smarty.capture.default.

{capture}鍙互琚祵濂椾娇鐢ㄣ

灞炴:

鍙傛暟鍚嶇О 绫诲瀷 蹇呴夊弬鏁 榛樿鍊 璇存槑
name string Yes n/a 鎹曡幏鍖哄煙鐨勫悕绉
assign string No n/a 鎹曡幏鍐呭鍚庤祴鍊肩殑鍙橀噺鍚
append string No n/a 灏嗘崟鑾风殑鍐呭澧炲姞鍒版暟缁勪腑

鍙夋爣璁:

鍚嶇О 璇存槑
nocache 鍏抽棴鎹曡幏鍖哄煙鐨勭紦瀛

璀﹀憡

褰撴崟鑾{insert}杈撳嚭鐨勬椂鍊欒灏忓績銆 濡傛灉寮鍚簡$caching骞朵笖 浣犲笇鏈涢氳繃{insert} 鍦ㄧ紦瀛樼殑椤甸潰涓婃樉绀哄姩鎬佸唴瀹癸紝閭d箞浣犳棤娉曟崟鑾疯繖浜涘唴瀹广

Example聽7.21.聽{capture}浣跨敤name灞炴


{* we don't want to print a div tag unless content is displayed *}
{capture name="banner"}
{capture "banner"} {* short-hand *}
  {include file="get_banner.tpl"}
{/capture}

{if $smarty.capture.banner ne ""}
<div id="banner">{$smarty.capture.banner}</div>
{/if}

   


Example聽7.22.聽{capture} 鎹曡幏鍐呭鍒板彉閲

涓嬮潰鏄痗apture鍑芥暟鐨勬紨绀


{capture name=some_content assign=popText}
{capture some_content assign=popText} {* short-hand *}
The server is {$my_server_name|upper} at {$my_server_addr}<br>
Your ip is {$my_ip}.
{/capture}
<a href="#">{$popText}</a>

     


Example聽7.23.聽{capture} 鎹曡幏鍐呭鍒版暟缁勫彉閲

涓嬮潰渚嬪瓙婕旂ず浜嗗浣曞娆℃崟鑾峰唴瀹癸紝褰㈡垚鏁扮粍銆


{capture append="foo"}hello{/capture}I say just {capture append="foo"}world{/capture}
{foreach $foo as $text}{$text} {/foreach}

     

杈撳嚭锛


I say just hello world

  


鍙傝 $smarty.capture, {eval}, {fetch}, fetch(){assign}.

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 19 plus 18? (Are you human?)

Advertisement