|
william drescher - 2009-12-11 22:15:55
// Load the template
$TBS->LoadTemplate("./new_patient.ott");
$dateNow = nowUS();
$TBS->MergeField('date', $dateNow);
$TBS->MergeField('time', '11:00 am');
// Define the name of the output file
$file_name = "new_patient" . date('Y-m-d-H-i-s').".odt";
// Output as a download file (some automatic fields are merged here)
$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $file_name);
----------------
echoing the $file name shows: new_patient2009-12-11-17-11-29.odt
but when I run it live the windows download dialogue shows that, but when when I open it in OO it shows that the file name is new_patient2009-12-11-17-11-29.odt.htm and windows tries to open it as a web page.
Suggestions for debugging ?
(BTW: I decided I could not do this in ajax so I have the program pop open a new window for the download, which works a treat.
bill
william drescher - 2009-12-12 10:44:57 - In reply to message 1 from william drescher
I verified that the file is indeed terminated by a .odt, not odt.htm, but one of the headers must be wrong as Firefox thinks it is a html file.
I tried looking at the headers using FireBug, but (I think) as it is in an opening window, FB does not catch the headers.
bill
william drescher - 2009-12-12 11:37:22 - In reply to message 2 from william drescher
found the error:
I was saving the template in OO template format, .ott and this caused the errors. When I changed it to .odt, it works just fine.
May I suggest that the package also accept the .ott extension?
bill
Skrol29 - 2009-12-13 20:35:25 - In reply to message 3 from william drescher
Hi Bill,
Thanks for your suggestion.
That will be added for the next version.
Meanwhile, you can have OpenTBS accepting ott, just by adding the following line after the include() :
$GLOBALS['_OPENTBS_AutoExt']['ott'] = $GLOBALS['_OPENTBS_AutoExt']['odt'];
Regards,
Skrol29
william drescher - 2009-12-13 22:00:23 - In reply to message 4 from Skrol29
It turns out to be easier to just use the .odt extension. Works like a charm.
bill
|