Files
smarty/libs/plugins/function.assign.php

31 lines
654 B
PHP
Raw Normal View History

2002-01-31 20:49:40 +00:00
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: assign
* Purpose: assign a value to a template variable
* -------------------------------------------------------------
*/
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: */
?>