mirror of
				https://github.com/smarty-php/smarty.git
				synced 2025-10-31 12:21:36 +01:00 
			
		
		
		
	changed {popup_init} to only emit code once during a request
Thanks to TGKnIght from forums
This commit is contained in:
		| @@ -21,20 +21,24 @@ | ||||
|  */ | ||||
| function smarty_function_popup_init($params, &$smarty) | ||||
| { | ||||
|     $zindex = 1000; | ||||
|     static $already_init; | ||||
|      | ||||
|     if (!empty($params['zindex'])) { | ||||
|         $zindex = $params['zindex']; | ||||
|     } | ||||
|      | ||||
|     if (!empty($params['src'])) { | ||||
|         return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n" | ||||
|          . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; | ||||
|     } else { | ||||
|         $smarty->trigger_error("popup_init: missing src parameter"); | ||||
|     if (!$already_init) { | ||||
|         $zindex = 1000; | ||||
|          | ||||
|         if (!empty($params['zindex'])) { | ||||
|             $zindex = $params['zindex']; | ||||
|         } | ||||
|          | ||||
|         if (!empty($params['src'])) { | ||||
|             return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n" | ||||
|              . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; | ||||
|         } else { | ||||
|             $smarty->trigger_error("popup_init: missing src parameter"); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /* vim: set expandtab: */ | ||||
|  | ||||
| ?> | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user