Templates

by Armaghan Saqib, Thursday, December 15, 2022, 01:58 (491 days ago)

Templates are used in sql-ledger to customize invoices, orders print formats allowing users to use different set of templates for different languages.

There are 4 type of templates:

html
latex
text
XML

Templates processing workflow:

When any documents need to be printed, Perl code retrieves data from database, stores it in $form variables and then calls $form->parse_template to process that particular template.

Within the template, template variables are replaced with the data in $form variables and a temporary latex file is generated (for latex templates) and then converted to pdf.

Template variables are of the format <%variablename%>

So if you have $form->{firstname} = 'Armaghan Saqib' and then use <%firstname%> in the template, 'Armaghan Saqib' will replace the variable in the processed template file.


Complete thread:

 RSS Feed of thread