fetch() Retorna la salida del template Descripción stringfetch stringtemplate stringcache_id string$compile_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; ?> ]]> Usando fetch() y enviando a un e-mail El template email_body.tpl El template email_disclaimer.tpl usando el modificador {textformat}. y el script de PHP usando la función mail() getRow($sql); $smarty->assign('contact', $contact); mail($contact['email'], 'Subject', $smarty->fetch('email_body.tpl')); ?> ]]> Ver también {fetch} display(), {eval}, y template_exists().