浏览代码

Allow template sets to filter or completely change header delivery

pdontthink 18 年之前
父节点
当前提交
16ddf3151b
共有 2 个文件被更改,包括 29 次插入2 次删除
  1. 3 2
      class/template/Template.class.php
  2. 26 0
      templates/default/header.tpl

+ 3 - 2
class/template/Template.class.php

@@ -1316,7 +1316,7 @@ FIXME: We could make the incoming array more complex so it can
       * Send HTTP header(s) to browser.
       *
       * Subclasses can override this function if headers are
-      * managed differently in the template set's target output
+      * managed differently in the engine's target output
       * interface.
       *
       * @param mixed $headers A list of (or a single) header
@@ -1329,7 +1329,8 @@ FIXME: We could make the incoming array more complex so it can
         if (!is_array($headers)) $headers = array($headers);
 
         foreach ($headers as $header) {
-            header($header);
+            $this->assign('header', $header);
+            header($this->fetch('header.tpl'));
         }
 
     }

+ 26 - 0
templates/default/header.tpl

@@ -0,0 +1,26 @@
+<?php
+
+/**
+  * header.tpl
+  *
+  * Template for constructing a header that is sent to the browser.
+  *
+  * The following variables are available in this template:
+  *      + $header - The header string to be sent
+  *
+  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+  * @version $Id$
+  * @package squirrelmail
+  * @subpackage templates
+  */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+echo $header;
+
+