Document Variables¶
All document generation utilizes embedded variables when using templates. The format of a variable is ${variable}.
${field:x}
Where x is usually the field name.
${float:x}
Where x is a number coverted formatted as a floating number with possible thousands separator and decimals. These examples show the possibilities:
${float:1000} = 1,000.00 ${float.0:1000.234} = 1,000 ${float.4:1000.234} = 1,000.2340 $${float:1000} = $1,000.00
${file:x} experimental
This will include another template inside a template.
${file:header.txt}
${date:x}
Automatically enter a date. The example shows how it works (date shown is for demonstration).
${date:today} = 01/01/202X
${date:fillin} = ___/___/202X
${date:x} where x is a field name = the value of the field in mm/dd/yyyy format ${date:0000-00-00} = ___/___/202X
If the date value returned is 0000-00-00, it is converted to fillin format.
function::x(y,z)
Returns the text from a PHP method that exists in the current opo_export class instance. This is unsupported in docx and xlsx templates.
property::x
Returns the value of a property that exists in the current opo_export class instance. This is unsupported in docx and xlsx templates.