Inserts

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 16. Extending Smarty With Plugins
利用插件扩展smarty
Next

Inserts插入

<?php
/*
 * Smarty plugin
 * ------------------------------------------------------------- 
 * File: insert.time.php
 * Type: time
 * Name: time
 * Purpose: Inserts current date/time according to format
 * -------------------------------------------------------------
 */
function smarty_insert_time($params, &$smarty)
{
 if (empty($params['format'])) {
 $smarty->trigger_error("insert time: missing 'format' parameter");
 return;
 }

 $datetime = strftime($params['format']);
 return $datetime;
}
?>

Prev 来源:PHP中文社区 Home Next
Resources[资源] Up [附属]Appendixes