Files
smarty/libs/core/core.smarty_include_php.php
mohrt 6445150ba7 move core files into their own directory under SMARTY_DIR,
remove abstraction function _execute_core_function
2003-06-16 15:18:38 +00:00

61 lines
1.7 KiB
PHP

<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* called for included php files within templates
*
* @param string $_smarty_include_php_file
* @param string $_smarty_assign variable to assign the included template's
* output into
* @param boolean $_smarty_once uses include_once if this is true
* @param array $_smarty_include_vars associative array of vars from
* {include file="blah" var=$var}
*/
// $file, $assign, $once, $_smarty_include_vars
function smarty_core_smarty_include_php($params, &$this)
{
$_params = array('file_path' => $params['smarty_file']);
require_once(SMARTY_DIR . 'core/core.get_php_resource.php');
smarty_core_get_php_resource($_params, $this);
$_smarty_resource_type = $_params['resource_type'];
$_smarty_php_resource = $_params['php_resource'];
extract($params['smarty_include_vars'], EXTR_PREFIX_SAME, 'include_php_');
if (!empty($params['smarty_assign'])) {
ob_start();
if ($_smarty_resource_type == 'file') {
if($params['smarty_once']) {
include_once($_smarty_php_resource);
} else {
include($_smarty_php_resource);
}
} else {
eval($_smarty_php_resource);
}
$this->assign($params['smarty_assign'], ob_get_contents());
ob_end_clean();
} else {
if ($_smarty_resource_type == 'file') {
if($params['smarty_once']) {
include_once($_smarty_php_resource);
} else {
include($_smarty_php_resource);
}
} else {
eval($_smarty_php_resource);
}
}
}
/* vim: set expandtab: */
?>