| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Smarty method Get_Template_Vars | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * Returns a single or all template variables | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * @package Smarty | 
					
						
							|  |  |  | * @subpackage SmartyMethod | 
					
						
							|  |  |  | * @author Uwe Tews  | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  | * Returns a single or all template variables | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | /** | 
					
						
							|  |  |  | * Returns a single or all template variables | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * @param string $varname variable name or null | 
					
						
							|  |  |  | * @return string variable value or or array of variables | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2009-11-03 20:38:38 +00:00
										 |  |  | function  Smarty_Method_Get_Template_Vars($smarty, $varname = null, $_ptr = null, $search_parents = true) | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     if (isset($varname)) { | 
					
						
							|  |  |  |         $_var = $smarty->getVariable($varname, $_ptr, $search_parents); | 
					
						
							|  |  |  |         if (is_object($_var)) { | 
					
						
							|  |  |  |             return $_var->value; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  |             return null; | 
					
						
							|  |  |  |         }  | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         $_result = array(); | 
					
						
							|  |  |  |         if ($_ptr === null) { | 
					
						
							|  |  |  |             $_ptr = $smarty; | 
					
						
							|  |  |  |         } while ($_ptr !== null) { | 
					
						
							|  |  |  |             foreach ($_ptr->tpl_vars AS $key => $var) { | 
					
						
							|  |  |  |                 $_result[$key] = $var->value; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |             }  | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  |             // not found, try at parent
 | 
					
						
							| 
									
										
										
										
											2009-04-10 12:33:51 +00:00
										 |  |  |             if ($search_parents) { | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  |                 $_ptr = $_ptr->parent; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $_ptr = null; | 
					
						
							|  |  |  |             }  | 
					
						
							|  |  |  |         }  | 
					
						
							|  |  |  |         if ($search_parents) { | 
					
						
							|  |  |  |             foreach ($smarty->global_tpl_vars AS $key => $var) { | 
					
						
							|  |  |  |                 $_result[$key] = $var->value; | 
					
						
							| 
									
										
										
										
											2009-04-10 12:33:51 +00:00
										 |  |  |             }  | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |         }  | 
					
						
							| 
									
										
										
										
											2009-08-08 17:28:23 +00:00
										 |  |  |         return $_result; | 
					
						
							| 
									
										
										
										
											2009-03-22 16:09:05 +00:00
										 |  |  |     }  | 
					
						
							|  |  |  | }  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |