From 0cbe95a89dd1a22bea47fdb602bd401d8386e1b9 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Thu, 14 Jun 2007 01:19:05 -0400 Subject: [PATCH] tem_run() (and tem::run()) doesn't overwrite the template stored in the class with the one passed. wfpl uses message() --- metaform/template.html | 11 ++++++++++- metaform/template.php | 4 ++-- template.php | 14 ++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/metaform/template.html b/metaform/template.html index b28ceb0..039eaea 100644 --- a/metaform/template.html +++ b/metaform/template.html @@ -27,7 +27,16 @@ div.error { border: 2px solid red; padding: 13px; margin: 20px; background: #ffd

Add a new entryEdit entry "~~name.html~~"~form_name~ entry form

-

~error_message.html~

+ +
+ + +
+ +

~~message_text.html~~

+ +
+
diff --git a/metaform/template.php b/metaform/template.php index 5aa4395..537c22f 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -116,8 +116,7 @@ function ~form_name~() { $cc = ''; $bcc = ''; if(email($from, $to, $subject, $message, $cc, $bcc)) { - tem_set('error_message', 'Due to an internal error, your message could not be sent. Please try again later.'); - tem_sub('error'); + message('Due to an internal error, your message could not be sent. Please try again later.'); $error = true; } } @@ -143,6 +142,7 @@ function ~form_name~() { tem_set('upload_max_filesize', upload_max_filesize()); + display_messages(); tem_sub('form'); } diff --git a/template.php b/template.php index 80201e0..ffc83e7 100644 --- a/template.php +++ b/template.php @@ -145,22 +145,24 @@ class tem { # Run the template. Pass a filename, or a string, unless you've already # specified a template with load() function run($templ = false) { + $template_string = $this->template; + $template_file = $this->file; if($templ !== false) { if(strlen($templ) < 150 && file_exists($templ)) { - $this->filename = $templ; - unset($this->template); + $template_file = $templ; + unset($template_string); } else { - $this->template = $templ; + $template_string = $templ; } } - if(!$this->template) { - if(!$this->filename) { + if(!$template_string) { + if(!$template_file) { print "sorry, no template to run\n"; exit(1); } - $this->template = read_whole_file($this->filename); + $template_string = read_whole_file($template_file); } return template_run($this->template, $this->keyval); -- 1.7.10.4