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

{block}

{block}鍙湪妯℃澘涓婂畾涔変竴鍧楀尯鍩燂紝浠ヨ繘琛屾ā鏉跨户鎵裤傝缁嗗弬瑙妯℃澘缁ф壙.

瀛愭ā鏉夸腑鐨{block}鍖哄煙浠g爜锛屽皢浼氭浛鎹㈢埗妯℃澘瀵瑰簲鐨勫尯鍩熶唬鐮併

鍙﹀锛{block}鍙互璁剧疆鎴愬悎骞剁埗瀛愭ā鏉跨殑鐩稿簲鍖哄煙銆傚湪瀛愭ā鏉跨殑{block}涓畾涔 appendprepend锛屽彲浠ヤ娇瀛愭ā鏉块檮鍔犲湪鐖舵ā鏉 {block}鍖哄煙鐨勫悗闈㈡垨鍓嶉潰銆 鍦{block}鍐呭涓娇鐢▄$smarty.block.parent}锛屽彲浠ヨ鐖舵ā鏉跨殑鍖哄煙浠g爜鏀惧埌 瀛愭ā鏉{block}鍐呯殑浠讳綍浣嶇疆銆

{blocks}鍙互宓屽浣跨敤銆

灞炴:

鍙傛暟鍚嶇О 绫诲瀷 蹇呴夊弬鏁 榛樿鍊 璇存槑
name string Yes n/a 妯℃澘鍖哄煙鐨勫悕绉

鍙夊睘鎬 (浠呭湪瀛愭ā鏉夸腑浣跨敤):

鍚嶇О 璇存槑
append {block}鍖哄煙浠g爜灏嗛檮鍔犲埌鐖舵ā鏉跨殑{block}鍐呭涔嬪悗
prepend {block}鍖哄煙浠g爜灏嗛檮鍔犲埌鐖舵ā鏉跨殑{block}鍐呭涔嬪墠
hide 鍦ㄦ病鏈夎鍚嶇О鍖哄煙鐨勬椂鍊欙紝蹇界暐鍖哄煙鍐呭銆
nocache 鍏抽棴{block} 缂撳瓨

Example聽7.15.聽绠鍗曠殑 {block} 渚嬪瓙

parent.tpl


<html>
  <head>
    <title>{block name="title"}Default Title{/block}</title>
    <title>{block "title"}Default Title{/block}</title>  {* short-hand  *}
  </head>
</html>

  

child.tpl


{extends file="parent.tpl"} 
{block name="title"}
Page Title
{/block}

  

缁撴灉杈撳嚭锛


<html>
  <head>
    <title>Page Title</title>
  </head>
</html>


Example聽7.16.聽鍓嶉潰闄勫姞 {block} 渚嬪瓙

parent.tpl


<html>
  <head>
    <title>{block name="title"}Title - {/block}</title>
  </head>
</html>

  

child.tpl


{extends file="parent.tpl"} 
{block name="title" prepend}
Page Title
{/block}

  

缁撴灉杈撳嚭


<html>
  <head>
    <title>Title - Page Title</title>
  </head>
</html>


Example聽7.17.聽鍚庨潰闄勫姞 {block} 渚嬪瓙

parent.tpl


<html>
  <head>
    <title>{block name="title"} is my title{/block}</title>
  </head>
</html>

  

child.tpl


{extends file="parent.tpl"} 
{block name="title" append}
Page Title
{/block}

  

缁撴灉杈撳嚭锛


<html>
  <head>
    <title>Page title is my titel</title>
  </head>
</html>


Example聽7.18.聽{$smarty.block.child} 渚嬪瓙

parent.tpl


<html>
  <head>
    <title>{block name="title"}The {$smarty.block.child} was inserted here{/block}</title>
  </head>
</html>

  

child.tpl


{extends file="parent.tpl"} 
{block name="title"}
Child Title
{/block}

  

缁撴灉杈撳嚭锛


<html>
  <head>
    <title>The Child Title was inserted here</title>
  </head>
</html>


Example聽7.19.聽{$smarty.block.parent} 渚嬪瓙

parent.tpl


<html>
  <head>
    <title>{block name="title"}Parent Title{/block}</title>
  </head>
</html>

  

child.tpl


{extends file="parent.tpl"} 
{block name="title"}
You will see now - {$smarty.block.parent} - here
{/block}

  

缁撴灉杈撳嚭锛


<html>
  <head>
    <title>You will see now - Parent Title - here</title>
  </head>
</html>


鍙傝 妯℃澘缁ф壙, $smarty.block.parent, $smarty.block.child, 鍜 {extends}

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 1 plus 2? (Are you human?)

Advertisement