TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Capture show() output in variable

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Fabrizio Lodi
Date: 2016-01-06
Time: 11:26

Capture show() output in variable

I want to get the template result in a variable and not printed on screen.

I've tried that:

ob_start();
$TBS->Show();
$xmlpa=ob_get_contents();
ob_end_clean();

but it does not work. Any suggestion?

Thank you
By: Skrol29
Date: 2016-01-07
Time: 23:55

Re: Capture show() output in variable

Hi,

Use the Render argument of method Show() in order to not send the result to the browser.
  http://www.tinybutstrong.com/manual.php#php_show

Then you can get the result which is stored in $TBS->Source
By: Fabrizio Lodi
Date: 2016-01-08
Time: 12:08

Re: Capture show() output in variable

Thank you very much!