New getHTML() method for QuickTemplate to get the HTML of a template.
authorJack Phoenix <jack@countervandalism.net>
Thu, 21 Nov 2013 07:47:39 +0000 (09:47 +0200)
committerJack Phoenix <jack@countervandalism.net>
Thu, 21 Nov 2013 11:38:31 +0000 (13:38 +0200)
OutputPage's addTemplate() is now a wrapper around QuickTemplate.

This allows more flexible usage of templated HTML, as
required by some third-party extensions.

Change-Id: I943e8e50438c716b7b56d2f908da38a4bf73d9e2

includes/OutputPage.php
includes/SkinTemplate.php

index 5ffb802..638887b 100644 (file)
@@ -1629,10 +1629,7 @@ class OutputPage extends ContextSource {
         * @param $template QuickTemplate
         */
        public function addTemplate( &$template ) {
-               ob_start();
-               $template->execute();
-               $this->addHTML( ob_get_contents() );
-               ob_end_clean();
+               $this->addHTML( $template->getHTML() );
        }
 
        /**
index 014d514..2808cf9 100644 (file)
@@ -1457,6 +1457,20 @@ abstract class QuickTemplate {
        public function getSkin() {
                return $this->data['skin'];
        }
+
+       /**
+        * Fetch the output of a QuickTemplate and return it
+        *
+        * @since 1.23
+        * @return String
+        */
+       public function getHTML() {
+               ob_start();
+               $this->execute();
+               $html = ob_get_contents();
+               ob_end_clean();
+               return $html;
+       }
 }
 
 /**