mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-16 14:05:21 +02:00
Implemented plugin architecture.
This commit is contained in:
31
libs/plugins/function.assign.php
Normal file
31
libs/plugins/function.assign.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* Type: function
|
||||
* Name: assign
|
||||
* Purpose: assign a value to a template variable
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_assign($args, &$smarty_obj)
|
||||
{
|
||||
extract($args);
|
||||
|
||||
if (empty($var)) {
|
||||
$smarty_obj->_trigger_error_msg("assign: missing 'var' parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!in_array('value', array_keys($args))) {
|
||||
$smarty_obj->_trigger_error_msg("assign: missing 'value' parameter");
|
||||
return;
|
||||
}
|
||||
|
||||
$smarty_obj->assign($var, $value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
||||
?>
|
Reference in New Issue
Block a user