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
24 function smarty_block_crmScope($params, $content, &$smarty, &$repeat) {
25 // A list of variables/values to save temporarily
26 static $backupFrames = array();
30 $vars = $smarty->get_template_vars();
31 $backupFrame = array();
32 foreach ($params as $key => $value) {
33 $backupFrame[$key] = isset($vars[$key]) ?
$vars[$key] : NULL;
35 $backupFrames[] = $backupFrame;
36 _smarty_block_crmScope_applyFrame($smarty, $params);
40 _smarty_block_crmScope_applyFrame($smarty, array_pop($backupFrames));
46 function _smarty_block_crmScope_applyFrame(&$smarty, $frame) {
47 foreach ($frame as $key => $value) {
48 $smarty->assign($key, $value);