1 |
<?php |
2 |
|
3 |
/* |
4 |
* Smarty plugin |
5 |
* ------------------------------------------------------------- |
6 |
* Type: function |
7 |
* Name: assign |
8 |
* Purpose: assign a value to a template variable |
9 |
* ------------------------------------------------------------- |
10 |
*/ |
11 |
function smarty_function_assign($params, &$smarty) |
12 |
{ |
13 |
extract($params); |
14 |
|
15 |
if (empty($var)) { |
16 |
$smarty->trigger_error("assign: missing 'var' parameter"); |
17 |
return; |
18 |
} |
19 |
|
20 |
if (!in_array('value', array_keys($params))) { |
21 |
$smarty->trigger_error("assign: missing 'value' parameter"); |
22 |
return; |
23 |
} |
24 |
|
25 |
$smarty->assign($var, $value); |
26 |
} |
27 |
|
28 |
/* vim: set expandtab: */ |
29 |
|
30 |
?> |