| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Smarty plugin | 
					
						
							|  |  |  |  * @package Smarty | 
					
						
							|  |  |  |  * @subpackage plugins | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * called for included php files within templates | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2003-06-19 16:25:19 +00:00
										 |  |  |  * @param string $smarty_file | 
					
						
							|  |  |  |  * @param string $smarty_assign variable to assign the included template's | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |  *               output into | 
					
						
							| 
									
										
										
										
											2003-06-19 16:25:19 +00:00
										 |  |  |  * @param boolean $smarty_once uses include_once if this is true | 
					
						
							|  |  |  |  * @param array $smarty_include_vars associative array of vars from | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |  *              {include file="blah" var=$var} | 
					
						
							| 
									
										
										
										
											2003-10-11 08:55:53 +00:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-06-29 22:57:33 +00:00
										 |  |  | //  $file, $assign, $once, $_smarty_include_vars
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function smarty_core_smarty_include_php($params, &$smarty) | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2003-06-29 22:57:33 +00:00
										 |  |  |     $_params = array('resource_name' => $params['smarty_file']); | 
					
						
							| 
									
										
										
										
											2004-09-16 23:07:32 +00:00
										 |  |  |     require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); | 
					
						
							| 
									
										
										
										
											2003-06-29 22:57:33 +00:00
										 |  |  |     smarty_core_get_php_resource($_params, $smarty); | 
					
						
							|  |  |  |     $_smarty_resource_type = $_params['resource_type']; | 
					
						
							|  |  |  |     $_smarty_php_resource = $_params['php_resource']; | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (!empty($params['smarty_assign'])) { | 
					
						
							|  |  |  |         ob_start(); | 
					
						
							|  |  |  |         if ($_smarty_resource_type == 'file') { | 
					
						
							| 
									
										
										
										
											2003-08-13 16:37:12 +00:00
										 |  |  |             $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-08-13 16:37:12 +00:00
										 |  |  |             $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2003-06-29 22:57:33 +00:00
										 |  |  |         $smarty->assign($params['smarty_assign'], ob_get_contents()); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         ob_end_clean(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         if ($_smarty_resource_type == 'file') { | 
					
						
							| 
									
										
										
										
											2003-08-13 16:37:12 +00:00
										 |  |  |             $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2003-08-13 16:37:12 +00:00
										 |  |  |             $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); | 
					
						
							| 
									
										
										
										
											2003-05-08 20:21:16 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* vim: set expandtab: */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ?>
 |