Allow template sets to define what the content-type of their output is.
[squirrelmail.git] / class / template / Template.class.php
index 31244fd6eb60fad81e4f070588803b7d2d774206..e02bc05f2badd02ecbd89e2957f34a772193802e 100644 (file)
@@ -69,6 +69,11 @@ class Template
       */
     var $template_engine = '';
 
+    /**
+      * The content type for this template set
+      */
+    var $content_type = '';
+
     /**
       * The fall-back template ID
       *
@@ -191,6 +196,13 @@ class Template
             = Template::calculate_template_file_directory($this->fallback_template_set_id);
 
 
+        // determine content type, defaulting to text/html
+        //
+        $this->content_type = Template::get_template_config($this->template_set_id,
+                                                            'content_type',
+                                                            'text/html');
+
+
         // determine template engine
         // FIXME: assuming PHP template engine may not necessarily be a good thing
         //
@@ -491,6 +503,18 @@ class Template
 
     }
 
+    /**
+      * Return the content-type for this template set.
+      *
+      * @return string The content-type.
+      *
+      */
+    function get_content_type() {
+
+        return $this->content_type;
+
+    }
+
     /**
       * Get template set config setting
       *