4 * Smarty block function to temporarily define variables.
18 * @param array $params must define 'name'
19 * @param string $content Default content
20 * @param object $smarty the Smarty object
26 function smarty_block_crmScope($params, $content, &$smarty, &$repeat) {
27 // A list of variables/values to save temporarily
28 static $backupFrames = array();
32 $vars = $smarty->get_template_vars();
33 $backupFrame = array();
34 foreach ($params as $key => $value) {
35 $backupFrame[$key] = isset($vars[$key]) ?
$vars[$key] : NULL;
37 $backupFrames[] = $backupFrame;
38 _smarty_block_crmScope_applyFrame($smarty, $params);
42 _smarty_block_crmScope_applyFrame($smarty, array_pop($backupFrames));
48 function _smarty_block_crmScope_applyFrame(&$smarty, $frame) {
49 foreach ($frame as $key => $value) {
50 $smarty->assign($key, $value);