fetch

PHP Smarty

Smarty - the compiling PHP template engine
Prev 来源:PHP中文社区 Chapter 13. Methods Next

fetch
取得输出的内容

include("Smarty.class.php");
$smarty = new Smarty;

$smarty->caching = true;

// only do db calls if cache doesn't exist
// 只有在缓存不存在时才调用数据库
if(!$smarty->is_cached("index.tpl"))
{

// dummy up some data
$address = "245 N 50th";
$db_data = array(
"City" => "Lincoln",
"State" => "Nebraska",
"Zip" = > "68502"
);

$smarty->assign("Name","Fred");
$smarty->assign("Address",$address);
$smarty->assign($db_data);

}

// capture the output
// 捕获输出
$output = $smarty->fetch("index.tpl");

// do something with $output here
// 对将要输出的内容进行处理

echo $output;

Prev 来源:PHP中文社区 Home Next
display
显示
Up get_config_vars
取配置变量的值