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

编写插件

插件可以让Smarty自动载入,或通过register_* API函数在运行时进行注册。 它们还可以通过unregister_* API函数来注销。

当插件是运行时注册的,插件的名称不一定需要遵循下面的命名规则。

如果插件依赖与其他插件提供的功能时(如依赖与一些Smarty自带的插件), 比较好的方法是像下面这样载入需要的插件:


<?php
function smarty_function_yourPlugin(array $params, Smarty_Internal_Template $template)
{
  // 载入依赖的插件
  $template->smarty->loadPlugin('smarty_shared_make_timestamp');
  // 插件代码
}
?>

    

一般而言,Smarty_Internal_Template对象将作为插件的最后一个参数传递, 除了两种例外情况:

  • 修饰器完全不接受Smarty_Internal_Template对象。

  • 为了向上兼容老版本的Smarty,区块插件将 $repeat 作为最后一个参数,因此Smarty对象是倒数第二个参数。

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 20? (Are you human?)

Advertisement