Guest User

odt serial

a guest
Nov 9th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. <?php
  2.  
  3. // Include classes
  4. include_once('tbs_class.php'); // Load the TinyButStrong template engine
  5. include_once('../tbs_plugin_opentbs.php'); // Load the OpenTBS plugin
  6.  
  7. $recset = array();
  8. $recset[] = array('title'=>'Iyy will love you' , 'rank'=>'A');
  9. $recset[] = array('title'=>'Tender thender' , 'rank'=>'B');
  10. $recset[] = array('title'=>'I got you babe' , 'rank'=>'C');
  11. $recset[] = array('title'=>'Only with you' , 'rank'=>'D');
  12. $recset[] = array('title'=>'Love me tender' , 'rank'=>'E');
  13. $recset[] = array('title'=>'Wait for me' , 'rank'=>'F');
  14. $recset[] = array('title'=>'Happy pop' , 'rank'=>'G');
  15. $recset[] = array('title'=>'Kiss me like that', 'rank'=>'H');
  16. $recset[] = array('title'=>'Love me so' , 'rank'=>'I');
  17. $recset[] = array('title'=>'Us, you and I' , 'rank'=>'J');
  18.  
  19.  
  20. // Initialize the TBS instance
  21. $TBS = new clsTinyButStrong; // new instance of TBS
  22. $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load the OpenTBS plugin
  23.  
  24. $TBS->LoadTemplate('test.odt', OPENTBS_ALREADY_UTF8);
  25.  
  26. // ----------------------
  27. // Debug mode of the demo
  28. // ----------------------
  29. if (isset($_POST['debug']) && ($_POST['debug']=='current')) $TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT, true); // Display the intented XML of the current sub-file, and exit.
  30. if (isset($_POST['debug']) && ($_POST['debug']=='info')) $TBS->Plugin(OPENTBS_DEBUG_INFO, true); // Display information about the document, and exit.
  31. if (isset($_POST['debug']) && ($_POST['debug']=='show')) $TBS->Plugin(OPENTBS_DEBUG_XML_SHOW); // Tells TBS to display information when the document is merged. No exit.
  32.  
  33. $TBS->MergeBlock('bx',$recset);
  34.  
  35. // Define the name of the output file
  36. $save_as = (isset($_POST['save_as']) && (trim($_POST['save_as'])!=='') && ($_SERVER['SERVER_NAME']=='localhost')) ? trim($_POST['save_as']) : '';
  37. $output_file_name = str_replace('.', '_'.date('Y-m-d').$save_as.'.', $template);
  38. if ($save_as==='') {
  39. // Output the result as a downloadable file (only streaming, no data saved in the server)
  40. $TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
  41. // Be sure that no more output is done, otherwise the download file is corrupted with extra data.
  42. exit();
  43. } else {
  44. // Output the result as a file on the server.
  45. $TBS->Show(OPENTBS_FILE, $output_file_name); // Also merges all [onshow] automatic fields.
  46. // The script can continue.
  47. exit("File [$output_file_name] has been created.");
  48. }
Advertisement
Add Comment
Please, Sign In to add comment