The tinyDoc class
The class can be used alone and have almost functionality as the plugin for symfony framework.
An example of code
// libs
include('your-path-to-lib/tinyButStrong.class.php');
include('your-path-to-lib/tinyDoc.class.php');
// create the document
$doc = new tinyDoc();
$doc->setZipMethod('shell');
$doc->setZipBinary('zip');
$doc->setUnzipBinary('unzip');
$doc->setProcessDir('./tmp');
$doc->createFrom('templates/your-document.odt');
$doc->loadXml('content.xml');
$doc->mergeXmlField('field1', 'variable');
$doc->mergeXmlField('field2', array('id' => 55, 'name' => 'bob'));
$doc->mergeXmlBlock('block1',
array(
array('firstname' => 'John' , 'lastname' => 'Doe'),
array('firstname' => 'Douglas', 'lastname' => 'Adams'),
array('firstname' => 'Roger' , 'lastname' => 'Waters'),
)
);
$doc->saveXml();
$doc->close();
// send and remove the document
$doc->sendResponse();
$doc->remove();
The main differences with the plugin is to instanciate the class with new tinyDoc() and to fix the parameters. That's all.
Replace
// create the document
$doc = new sfTinyDoc();
by
// create the document
$doc = new tinyDoc();
$doc->setZipMethod('shell');
$doc->setZipBinary('zip');
$doc->setUnzipBinary('unzip');
$doc->setProcessDir('./tmp');
or if you want to use ZipArchive
// create the document
$doc = new tinyDoc();
$doc->setZipMethod('ziparchive');
$doc->setProcessDir('./tmp');
and load the lib
// libs
include('your-path-to-lib/tinyButStrong.class.php');
include('your-path-to-lib/tinyDoc.class.php');

