Categories > OpenTBS with DOCX >

no merging of automatic fields

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jan
Date: 2014-05-19
Time: 15:11

no merging of automatic fields

I've setup my code with openTBS on my localhost and it works fine: it generates the docx I expect.
After placing everything at the server of my provider there is no merging of all the onload or onshow fields.
What I receive in my donwloaded docx is the template with the tbs fields, none of the data is merged.
The only thing that is merged is data in a MergeBlock, so some merging works.
First I thought is was a read/write problem of some dir's, but I checked that.
Anyone to help me out here?
By: Skrol29
Date: 2014-05-26
Time: 17:05

Re: no merging of automatic fields

Hi Jan,

Regarding to the complementary details you sent to me by email, it seems that the merging process is run but that there's a problem of variable scope.

Locally, the variable $gravesHeader2ODF is correctly found by OpenTBS as a global variable.
But in you server, it is not found as a global variable.
This may happen if your code is not run in the same context on your server, for example if is is called by a main script.

You can check by coding
var_export($GLOBALS['gravesHeader2ODF'])
just before the $TBS->Show() line.
And check if you have the same reply locally and at your server.

In order to ensure that the variable is global in your code, you can use the command "global" or the syntax with "$GLOBALS['gravesHeader2ODF']".
You can also use the VarRef property in order to not use global variables.
See http://www.tinybutstrong.com/manual.php#php_varref