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

Name

display() 鈥 鏄剧ず

璇存槑

void聽display(string聽template,
聽聽聽聽聽聽聽聽聽聽聽聽聽string聽cache_id,
聽聽聽聽聽聽聽聽聽聽聽聽聽string聽compile_id);

鏄剧ず妯℃澘銆傚鏋滃笇鏈涜繑鍥炶屽苟闈炴樉绀哄綋鍓嶆ā鏉跨殑鍐呭锛岃浣跨敤fetch()銆 璇ュ嚱鏁伴渶瑕佹寚瀹氫竴涓悎娉曠殑妯℃澘璧勬簮鐨勭被鍨嬪拰璺緞銆 绗簩涓彲閫夌殑鍙傛暟$cache_id璁剧疆缂撳瓨锛岃鎯呭弬瑙 缂撳瓨

As an optional third parameter, you can pass a $compile_id. This is in the event that you want to compile different versions of the same template, such as having separate templates compiled for different languages. You can also set the $compile_id variable once instead of passing this to each call to this function.

Example聽14.19.聽display()


<?php
include(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty();
$smarty->setCaching(true);

// 浠呭湪缂撳瓨涓嶅瓨鍦ㄧ殑鏃跺欒皟鐢
if(!$smarty->isCached('index.tpl')) {

  // 鏁版嵁
  $address = '245 N 50th';
  $db_data = array(
               'City' => 'Lincoln',
               'State' => 'Nebraska',
               'Zip' => '68502'
             );

  $smarty->assign('Name', 'Fred');
  $smarty->assign('Address', $address);
  $smarty->assign('data', $db_data);

}

// 鏄剧ず
$smarty->display('index.tpl');
?>

   

Example聽14.20.聽鍏朵粬 display() 鐨勭ず渚

妯℃澘璧勬簮鐨勬柟寮忔潵鏄剧ず涓嶅湪 $template_dir鐩綍涓嬬殑妯℃澘銆


<?php
// 缁濆璺緞
$smarty->display('/usr/local/include/templates/header.tpl');

// 缁濆璺緞锛堜娇鐢╢ile://锛
$smarty->display('file:/usr/local/include/templates/header.tpl');

// windows鐜鐨勭粷瀵硅矾寰勶紙鍔″繀鏄痜ile:寮澶达級
$smarty->display('file:C:/www/pub/templates/header.tpl');

// 鏉ヨ嚜妯℃澘璧勬簮搴揹b
$smarty->display('db:header.tpl');
?>

   

鍙傝 fetch()templateExists().

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 15 plus 5? (Are you human?)

Advertisement