Page 1 of 1

ProcessTemplate

Posted: Thu Mar 02, 2017 6:37 pm
by magallo
Hi Guys, i'm able to display the template but is it possible to convert it into a string to be emailed or echoed?

Code: Select all

$tpl_ob = $smarty->CreateTemplate($this->GetTemplateResource($somestring));
$tpl_ob->assign('foo','bar');
$tpl_ob->display();
is there something i can use instead of $tpl_ob->display() ?

also, is there a way to process Content Blocks as templates?
Thanks for the help

Re: ProcessTemplate

Posted: Thu Mar 02, 2017 6:48 pm
by calguy1000

Code: Select all

$out = $tpl_ob->fetch();

Re: ProcessTemplate

Posted: Thu Mar 02, 2017 6:57 pm
by magallo
Thanks.

Is there a way to process a Content Block as templates instead of a file?

{global_content name='Email 1 Template'}

$tpl_ob = $smarty->CreateTemplate($this->GetTemplateResource($somestring));

Re: ProcessTemplate

Posted: Thu Mar 02, 2017 8:18 pm
by calguy1000

Code: Select all

$tpl = $smarty->CreateTemplate('cms_template:My Template Name');
$tpl->assign('foo','bar');
echo $tpl->fetch();