ProcessTemplate

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Locked
User avatar
magallo
Forum Members
Forum Members
Posts: 105
Joined: Thu Mar 24, 2011 12:37 am

ProcessTemplate

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: ProcessTemplate

Post by calguy1000 »

Code: Select all

$out = $tpl_ob->fetch();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
magallo
Forum Members
Forum Members
Posts: 105
Joined: Thu Mar 24, 2011 12:37 am

Re: ProcessTemplate

Post 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));
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: ProcessTemplate

Post by calguy1000 »

Code: Select all

$tpl = $smarty->CreateTemplate('cms_template:My Template Name');
$tpl->assign('foo','bar');
echo $tpl->fetch();
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Locked

Return to “Developers Discussion”