2002-01-31 20:49:40 +00:00
|
|
|
<?php
|
2003-04-20 21:12:13 +00:00
|
|
|
/**
|
|
|
|
* Smarty plugin
|
|
|
|
* @package Smarty
|
|
|
|
* @subpackage plugins
|
|
|
|
*/
|
2002-01-31 20:49:40 +00:00
|
|
|
|
|
|
|
/*
|
2003-04-20 21:12:13 +00:00
|
|
|
* Smarty {assign} function plugin
|
|
|
|
*
|
|
|
|
* Type: function<br>
|
|
|
|
* Name: assign<br>
|
2002-01-31 20:49:40 +00:00
|
|
|
* Purpose: assign a value to a template variable
|
2003-04-20 21:12:13 +00:00
|
|
|
* @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign}
|
|
|
|
* (Smarty online manual)
|
|
|
|
* @param array Format: array('var' => variable name, 'value' => value to assign)
|
|
|
|
* @param Smarty
|
2002-01-31 20:49:40 +00:00
|
|
|
*/
|
2002-02-20 22:24:32 +00:00
|
|
|
function smarty_function_assign($params, &$smarty)
|
2002-01-31 20:49:40 +00:00
|
|
|
{
|
2002-02-20 22:24:32 +00:00
|
|
|
extract($params);
|
2002-01-31 20:49:40 +00:00
|
|
|
|
|
|
|
if (empty($var)) {
|
2002-02-20 22:24:32 +00:00
|
|
|
$smarty->trigger_error("assign: missing 'var' parameter");
|
2002-01-31 20:49:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-20 22:24:32 +00:00
|
|
|
if (!in_array('value', array_keys($params))) {
|
|
|
|
$smarty->trigger_error("assign: missing 'value' parameter");
|
2002-01-31 20:49:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-02-20 22:24:32 +00:00
|
|
|
$smarty->assign($var, $value);
|
2002-01-31 20:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set expandtab: */
|
|
|
|
|
|
|
|
?>
|