#### cut and paste the following into a file for public access #### ------------------------------------------------------------------- list_items(); //generate list of items $->new_item(); //create empty form fields for a new item /** * Whether to display a list of "tags" for this data that can be included * in the template page. Uncomment to show all the tags that can be included. * EG, form fields, form labels, page headers etc. Add the Boolean argument 'true' * to display only 'field value' tags (Useful if you just want to populate a 'display only' * list of values from the database) */ $->display_tags_for_coding(); /** * Load template: Defaults to "templates/".CURRENT_FILE_BASENAME.".htm", * but can load other template via function argument EG. output_webpage($template_path."/name") */ $->output_webpage(); //bungs all the data in the default (or named) template and renders the page. /** * You also have the option to output the result of the merge as a file based on a * source template, such as a word / openoffice / libreoffice document, or a spreadsheet. * The file can be output in many ways, such as the original filetype, or a pdf, saved in the database, * attached to an email. It can be merely geenrated & saved, or offered for download to the client. * * Instructions on creating the template document & variables can be found in the manual at: * /lib/documentation/TBS/OpenTBS - document plugin.html OR * http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html * * If saving to a filepath other than the default (/document_cache), * specify the path here, relative to the web root (/) * $->save_to_file_path = ''; * * If saving a binary stream (such as a PDF report) to a BLOB in the database, * specify the SQL here: * $->save_to_db_sql = ''; * * * * The "output as file" works thusly: * $->output_document($source_template,$output_filename,[$process_type,$download_after,$delete_after]); * * The options are: * * $source_template (string) ## REQUIRED ## * filename of source document. relative to current file. EG: 'templates/invoice.odt' * * $output_filename (string) ## REQUIRED ## * filename (only, no path) of output file. If extension of file is .pdf, file is converted to PDF. * usually needs to be an XML type of document, ie, .docx, .odt, .xlsx * ####### It's Best to include some kind of uniqueness in the filename * (EG, table key_id, current timestamp etc.) so that a system generating many documents at once * doesn't cause file overwrite issues. ############################ * * $process_type (string) ## OPTIONAL ## * how to process the output. If not specified defaults to 'stream'. The Options are: * 'download' * offers output file to client for download * 'stream' * rather than a file, generates a binary stream for further processing * 'save_to_db' @@@@@ TO IMPLEMENT @@@@@@@ * Will generate a binary stream and then save to database 'BLOB' field using sql in * $->save_to_db_sql * 'email' @@@@@ TO IMPLEMENT @@@@@@@ * Will attach binary data stream to email for sending to client. Not yet written * 'save_to_fs' * Saves output file to filesystem for later use. * If no path is specified in $->save_to_file_path, uses 'DOCUMENT_CACHE' * * $download_after (bool) ## OPTIONAL, default false ## * if true, downloads output document to client. Useful in cases such as saving a report to * the database, but also giving a copy to the client. Obviously pointless to specify true if * $process_type has already sent it to the client. * * $delete_after (bool) ## OPTIONAL, default false ## * deletes any created files after processing. $proccess_types 'stream', 'email', 'save_to_db' * are automatically deleted by default * * * ### SOME EXAMPLES #### * * $->output_document('templates/invoice.odt','new_invoice.pdf','download'); * takes 'templates/invoice.odt', merges data, saves as 'new_invoice.pdf' and downloads to client.# * * $->output_document('templates/invoice.odt','new_invoice.docx','save_to_fs',true); * takes 'templates/invoice.odt', merges data to 'new_invoice.docx', saves to filesystem * (either default path or $->save_to_file_path ) and downloads to client. * */ unset($); ?>