fetchstringfetchstringtemplatestringcache_idstringcompile_id
Este retorna la salida del template en vez de desplegarla.
Proporcionando un tipo y path valido
template resource.
Como un segundo parámetro opcional, usted puede pasar el
identificador de cache.
vea el caching section para
mayor información.
¶meter.compileid;
fetch
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;
?>
]]>