JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
tem_run() (and tem::run()) doesn't overwrite the template stored in the class with...
authorJason Woofenden <jason183@herkamire.com>
Thu, 14 Jun 2007 05:19:05 +0000 (01:19 -0400)
committerJason Woofenden <jason183@herkamire.com>
Thu, 14 Jun 2007 05:19:05 +0000 (01:19 -0400)
wfpl uses message()

metaform/template.html
metaform/template.php
template.php

index b28ceb0..039eaea 100644 (file)
@@ -27,7 +27,16 @@ div.error { border: 2px solid red; padding: 13px; margin: 20px; background: #ffd
 <!--~~form start~~--><!--~form start~-->
   <h2><!--~opt_db_1 start~--><!--~~new_msg start~~-->Add a new entry<!--~~end~~--><!--~~edit_msg start~~-->Edit entry "~~name.html~~"<!--~~end~~--><!--~end~--><!--~opt_db_1_else start~-->~form_name~ entry form<!--~end~--></h2>
 
-  <!--~error start~--><div class="error"><h3>~error_message.html~</h3></div><!--~end~-->
+  <!--~~message_container start~~-->
+       <div style="border: 2px solid red; background: #fbb; padding: 5px; margin: 20px 0px">
+       <!--~~message_box start~~-->
+           <!--~~message_divider start~~-->
+               <hr />
+           <!--~~end~~-->
+           <p style="font-size: 120%; padding: 5px; margin: 0px">~~message_text.html~~</p>
+       <!--~~end~~-->
+       </div>
+  <!--~~end~~-->
 
   <form action="~form_name~.html~enctype_attr~" method="post"><!--~opt_db_2 start~--><!--~~editing start~~--><input type="hidden" name="~form_name~_edit_id" value="~~~form_name~_edit_id.attr~~" /><!--~~end~~--><!--~end~--><!--~uploads start~--><input type="hidden" name="MAX_FILE_SIZE" value="~~upload_max_filesize~~" /><!--~end~-->
     <table cellspacing="0" cellpadding="4" border="0" summary=""><!--~row start~-->
index 5aa4395..537c22f 100644 (file)
@@ -116,8 +116,7 @@ function ~form_name~() {<!--~opt_http_pass_2 start~-->
                                $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;
                                }
                        }<!--~end~-->
@@ -143,6 +142,7 @@ function ~form_name~() {<!--~opt_http_pass_2 start~-->
 
        tem_set('upload_max_filesize', upload_max_filesize());<!--~end~-->
 
+       display_messages();
        tem_sub('form');
 }
 
index 80201e0..ffc83e7 100644 (file)
@@ -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);