Forum


Replies: 12   Views: 4538
Addtemplatevariable only creates first row of table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by m.elfring  · 09-12-2013 - 13:23

Hello,



After hours and hours of debugging i discovered that the array containing the values of your variables requires the first element to be the first element in your table!



E.g. if your template table is like this:



Name | Adres

------------------------

$NAME$ | $ADDRESS$



Your array should look like this:

[0]=>array(

[NAME]=>my name

[ADDRESS]=>an address) 


[1]=>array(

[NAME]=>other name

[ADDRESS]=>other address) 



My array is filled by a query that is executed against a database and contained more fields than defined in the template table. This resulted in only one row getting filled. 



E.g. this did not work:



[0]=>array(

[COUNTRY]=>NL

[NAME]=>my name

[ADDRESS]=>an address) 

[1]=>array(

[COUNTRY]=>NL

[NAME]=>other name

[ADDRESS]=>other address) 



And this did work:

[0]=>array(

[NAME]=>my name

[ADDRESS]=>an address) 

[COUNTRY]=>NL

[1]=>array(

[NAME]=>other name

[ADDRESS]=>other address

[COUNTRY]=>NL)



Hope this helps.