Categories > TinyButStrong general >

how to return merged html instead of outputting?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: jason
Date: 2009-05-06
Time: 09:23

how to return merged html instead of outputting?

I'd like to do something like this because im using TBS for merging data with email templates for mailing. I dont want it to output, just return the data....

ie.

$subj="test";
$msg="hi";
$tbs->LoadTemplate("tpl/mail.tpl");
$mailMessage=$tbs->show(TBS_NOTHING);

mail( ... $mailMessage ... );



By: Skrol29
Date: 2009-05-06
Time: 09:37

Re: how to return merged html instead of outputting?

Hi Jason,

Here is the way:
$subj="test";
$msg="hi";
$tbs->LoadTemplate("tpl/mail.tpl");
$tbs->show(TBS_NOTHING);
$mailMessage=$tbs->Source;
By: jason
Date: 2009-05-06
Time: 10:05

Re: how to return merged html instead of outputting?

awesome! tbs is starting to grow on me.
but why doesnt this conditinal work for me?

PHP:
$x="a";
$TBS->Show();


TEMPLATE:
[var.x;if [var.x]==b]
[var.x;if [var.x]=='b']
[var.x;if [var.x]~=b]
[var.x;if 1==2]


OUTPUT:
a a a a

There should be NO output! right?
By: Skrol29
Date: 2009-05-06
Time: 14:10

Re: how to return merged html instead of outputting?

This is because parameter 'then' or 'else' is missing.

You can also use the keyword [val] for more optimization.

[var.x;if [val]==b;then '']
[var.x;if [val]=='b';then '']
[var.x;if [val]~=b; then '']
[var.x;if 1==2;then '']