I have an array that contains a value which I can access if I use the following code as a test:
include_once('tbs_class.php');
include_once('tbs_plugin_opentbs.php');
$company_valuation['number_of_years']=1 ;
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$TBS->LoadTemplate(SMARTY_PRIVATE_DIR.'templates/test.docx');
$TBS->Show(OPENTBS_DOWNLOAD, $file_name);
|
but using the same template when accessed from a included php class give me an error
TinyButStrong Error in field [onshow.company_valuation.number_of_years...]: the key 'company_valuation' does not exist or is not set in VarRef. (VarRef seems refers to $GLOBALS) This message can be cancelled using parameter 'noerr'.
TinyButStrong Error Show() Method: The output is cancelled by the OpenTBS plugin because at least one error has occured.
even though I have tried to use MergeBlock to make the $company_valuation array available.
include_once('tbs_class.php');
include_once('tbs_plugin_opentbs.php');
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$TBS->MergeBlock('company_valuation',array($company_valuation));
// $TBS->LoadTemplate(SMARTY_PRIVATE_DIR.'templates/'.'wordvaltemplate.docx');
$TBS->LoadTemplate(SMARTY_PRIVATE_DIR.'templates/'.'test.docx');
$TBS->Show(OPENTBS_DOWNLOAD, $file_name);
|
The template looks like this:
Date [onshow..now;frm='yyyy-mm-dd']
If the date works we know OPENTBS is working
onshow [onshow. company_valuation.number_of_years]
|
I have also tried different syntax for the MegeBlock line:
$TBS->MergeBlock('company_valuation',$company_valuation);
|
and
$TBS->MergeBlock('company_valuation','array',$company_valuation);
|
Any help for a new TBS user is appreciated.
Thanks,
David