I'm using http://www.tinybutstrong.com/plugins/opentbs/demo/demo.html and having trouble getting it to work. My .docx has real word mail merge fields. I've been trying to understand the documentation, all I can get out of it, is that the PHP demo code, seems to declare $your_name, and then it magically replaces onshow.your_name in the .docx.
In the first instance, I thought I used MergeBlock with an array of $data. Here's my code so far:
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$template = $_SERVER['DOCUMENT_ROOT'] . '/inc/dd.docx';
$data = array();
$data[] = array('ContactName'=>$this->title . ' ' . $this->firstname . ' ' . $this->surname,
'Address1'=>$this->address1,
'Address2'=>$this->address2,
'Address3'=>$this->town,
'Address4'=>$this->county,
'PostalCode'=>$this->postcode,
'Bacsref'=>$this->bb_number,
'Account_Name'=>$this->ac_name,
'SortCode'=>$this->CorrectedSortCode,
'Account_Number'=>$this->CorrectedAccountNumber);
$ContactName = $this->title . ' ' . $this->firstname . ' ' . $this->surname;
$TBS->LoadTemplate($template);
$TBS->MergeBlock('a,b', $data);
$file_name = $this->bb_number . ' Direct Debit';
//$TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT);
$TBS->Show(OPENTBS_DOWNLOAD, $file_name . '.docx');
The downloaded file hasn't got any of the mail merge fields replaced. From the demo, I can't infer how onshow.your_name, which doesn't look like a real word mail merge field, is replaced? All I see is some error checking code to determine $your_name...