By: sam
Date: 2009-12-23
Time: 09:36
|
OpenTBS newbie qn: How to get an extra field into the demo docx file
Hi all,
This is a simple qn.
Here I have a php file that works fine.
But I'd like to introduce a second variable besides the:
$yourname="Bob Jones";
For example I might want:
$yourtitle="Mr";
But when I put a field in the word dodx docuement like [onshow.yourname]
I get the error:
TinyButStrong Error in field [onshow.yourtitle] This message can be cancelled using parameter 'noerr'.
How do I make it work?
Also how do I change "onshow" to "mm" when inserted as a variable in word. e.g [onshow.yourtitle] works. But I'd like it to me [mm.yourtitle]
Here is the php file that works with only the [onshow.yourtitle] varialble:
<?php
// Display this code source is asked.
if (isset($_GET['source'])) exit(highlight_file(__FILE__,true));
// Libraries
include_once('tbs_class.php'); // TinyButStrong template engine
include_once('tbs_plugin_opentbs.php'); // OpenTBS plugin
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
$template = "samsdem1.docx";
$yourname="Bob Jones";
$TBS->LoadTemplate($template); // Define the name of the output file
$file_name = str_replace('.','_'.date('Y-m-d').'.',$template); // Define the name of the output file
$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $file_name);
//$TBS->Show(OPENTBS_FILE+TBS_EXIT, $file_name);
?>
|
By: Skrol29
Date: 2009-12-23
Time: 18:00
|
Re: newbie qn: How to get an extra field into the demo docx file
Hi Sam,
Your have this behavior probably because Ms Word cut the TBS field is several parts in its file source (.docx\word\document.xml). Word does that kind of stuff because of the spellchecker, or the autocorrect feature. Those can be deactivated but the text is steel cut sometimes.
You can check the "document.xml" to see what appended to your text.
|