summaryrefslogtreecommitdiff
path: root/LedgerSMB/Template.pm
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-13 17:45:30 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-13 17:45:30 +0000
commit576020a9432cba748ade22242be42e513f49b67f (patch)
treeaa10f040d59cac2178f20fc30a3b0c1158a513f0 /LedgerSMB/Template.pm
parent02d0ce186cfc17daba79f9c63fb0fe6061e9a766 (diff)
Adding a debug flag
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1584 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Template.pm')
-rwxr-xr-xLedgerSMB/Template.pm60
1 files changed, 51 insertions, 9 deletions
diff --git a/LedgerSMB/Template.pm b/LedgerSMB/Template.pm
index de0fa797..ba17f03e 100755
--- a/LedgerSMB/Template.pm
+++ b/LedgerSMB/Template.pm
@@ -11,17 +11,58 @@ This module renders templates.
=over
-=item new(user => \%myconfig, template => $string, format => 'HTML', [language => $string,] [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool]] );
+=item new(user => \%myconfig, template => $string, format => $string, [language => $string], [include_path => $path], [no_auto_output => $bool], [method => $string], [no_escape => $bool], [debug => $bool] );
This command instantiates a new template:
-template is the file name of the template to be processed.
-format is the type of format to be used. Currently only HTML is supported
-language (optional) specifies the language for template selection.
-include_path allows one to override the template directory and use this with user interface templates.
-no_auto_output disables the automatic output of rendered templates.
-no_escape disables escaping on the template variables.
-method is the output method to use, defaults to HTTP
-media is a synonym for method
+
+=over
+
+=item template
+
+The name of the template file to be processed.
+
+=item format
+
+The format to be used. Currently HTML, PS, PDF, TXT and CSV are supported.
+
+=item language (optional)
+
+The language for template selection.
+
+=item include_path (optional)
+
+Overrides the template directory. Used with user interface templates.
+
+=item no_auto_output (optional)
+
+Disables the automatic output of rendered templates.
+
+=item no_escape (optional)
+
+Disables escaping on the template variables.
+
+=item debug (optional)
+
+Enables template debugging.
+
+With the TT-based renderers, HTML, PS, PDF, TXT, and CSV, the portion of the
+template to get debugging messages is to be surrounded by
+<?lsmb DEBUG format 'foo' ?> statements. Example:
+
+ <tr><td colspan="<?lsmb columns.size ?>"></td></tr>
+ <tr class="listheading">
+ <?lsmb FOREACH column IN columns ?>
+ <?lsmb DEBUG format '$file line $line : [% $text %]' ?>
+ <th class="listtop"><?lsmb heading.$column ?></th>
+ <?lsmb DEBUG format '' ?>
+ <?lsmb END ?>
+ </tr>
+
+=item method/media (optional)
+
+The output method to use, defaults to HTTP. Media is a synonym for method
+
+=back
=item render($hashref)
@@ -64,6 +105,7 @@ sub new {
$self->{format} = 'PS' if lc $self->{format} eq 'postscript';
$self->{language} = $args{language};
$self->{no_escape} = $args{no_escape};
+ $self->{debug} = $args{debug};
if ($args{outputfile}) {
$self->{outputfile} =
"${LedgerSMB::Sysconfig::tempdir}/$args{outputfile}";