]>
git.p6c8.net - devedit.git/blob - modules/Output.pm
4 # Dev-Editor - Module Output
6 # HTML generating routines
8 # Author: Patrick Canterino <patrick@patshaping.de>
9 # Last modified: 2004-11-26
24 use base
qw(Exporter);
26 @EXPORT = qw(error_template
34 # Set the path to the template file used for error messages
37 # Params: Template file
46 # Format an error message
48 # Params: 1. Error message
49 # 2. Display a link to this path at the bottom of the page (optional)
50 # 3. Hash reference: Template variables (optional)
52 # Return: Formatted message (Scalar Reference)
56 my ($message,$path,$vars) = @_;
58 my $tpl = new Template
;
59 $tpl->read_file($tpl_error);
61 $tpl->fillin("ERROR",$message);
62 $tpl->fillin("BACK",$path);
63 $tpl->fillin("SCRIPT",encode_entities
($ENV{'SCRIPT_NAME'}));
65 $tpl->parse_if_block("dir",defined $path);
67 if(ref($vars) eq "HASH")
69 while(my ($key,$value) = each(%$vars))
71 $tpl->fillin($key,$value);
75 my $output = header
(-type
=> "text/html");
76 $output .= $tpl->get_template;
83 # Print an error message and exit script
86 # Params: 1. Error message
87 # 2. Display a link to this path at the bottom of the page (optional)
88 # 3. Hash reference: Template variables (optional)
92 my $output = error
(shift,shift,shift);
patrick-canterino.de