Categories > OpenTBS general >

Footers not replaced

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Mathijs
Date: 2011-02-16
Time: 14:32

Footers not replaced

Hi all,

I am using the example scripts found on: http://www.tinybutstrong.com/plugins/opentbs/demo/demo.html

But when i download all the needed files and try it on my own servers (PHP5) everything is replace but not the vars in the footer. Could anyone tell me how i will be able to fix that?

Below the code:

<?php

// Display this code source is asked.
if (isset($_GET['source'])) exit('<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>OpenTBS plug-in for TinyButStrong - demo source</title></head><body>'.highlight_file(__FILE__,true).'</body></html>');

// load the TinyButStrong libraries
include_once('tbs_class_php5.php'); // TinyButStrong template engine

// load the OpenTBS plugin
include_once('plugins/tbs_plugin_opentbs.php');

$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin

// Retrieve the template to use
$template = "test.docx";
$template = basename($template);
if (!file_exists($template)) exit("File does not exist.");

// Retrieve the name to display
$yourname = "Test Person";


// Prepare some data for the demo
$data = array();
$data[] = array('firstname'=>'Sandra', 'name'=>'Hill', 'number'=>'1523d' );
$data[] = array('firstname'=>'Roger', 'name'=>'Smith', 'number'=>'1234f' );
$data[] = array('firstname'=>'William', 'name'=>'Mac Dowell', 'number'=>'5491y' );

// Load the template
$TBS->LoadTemplate($template);
$TBS->MergeBlock('a,b', $data);

// Define the name of the output file
$file_name = str_replace('.','_'.date('Y-m-d').'.',$template);

// download
$TBS->Show(OPENTBS_DOWNLOAD, $file_name);
?>
By: Skrol29
Date: 2011-02-16
Time: 16:54

Re: Footers not replaced

Hi Mathijs,

> But when i download all the needed files and try it on my own servers (PHP5) everything is replace
> but not the vars in the footer. Could anyone tell me how i will be able to fix that?

OpenTBS version 1.5.0 beta has a new feature that load header and footer XML subfiles automatically.
If you have a prior version then you have to load the header and footer files manually.
Or you can download the version 1.5.0 beta which is very stable and about to be released.
By: Mathijs
Date: 2011-02-17
Time: 16:45

Re: Footers not replaced

Thanks a lot! That seems to work like a charm.