Categories > TinyButStrong general >

Write output in a file instead of showing it

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Tobi
Date: 2006-01-22
Time: 18:12

Write output in a file instead of showing it

Through the line $TBS->Show(); I will get the result printed out.

But I want to make a PDF through htmldoc and in this case I need result saved as a file.

How can I save the result in a file?

Thank you so much for an answer, tomorrow I have to hand my work in and i´m a little bit in hurry...
By: Tobi
Date: 2006-01-22
Time: 18:51

Re: Write output in a file instead of showing it

I have tryed it with:

$pdf = $TBS->Source;
$file = fopen("../temp/test.htm","w+");
fwrite ($file, $pdf);
fclose ($file);

nothing happens

also with

$pdf = $TBS->Source;
echo $pdf;

i cant see the code
By: Skrol29
Date: 2006-01-22
Time: 23:55

Re: Write output in a file instead of showing it

Hello Tobi,

Here is the way to get the source of the merged template into a string :
$TBS = new clsTinyButStrong;
$TBS->Render = TBS_NOTHING;
...
$TBS->MergeBlock(...); // or whatever
...
$TBS->Show() // no exit and no output because of Render
$x = $TBS->Source;

If you don't suceed to save the contents into a file, just check the contents before, by displaying it for example.
By: Tobi
Date: 2006-01-23
Time: 00:34

Re: Write output in a file instead of showing it

Thank you so much.
I´ve almost tried every situation, but with render=nothing and show not ;)