From ba78edcd1fa76c83457f1d21b5f9ba63a707ceb4 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 6 Aug 2011 16:35:15 -0400 Subject: [PATCH] Change Template::Render to return the result, rather than print it. --- testing/tests/views/template_test.php | 6 +----- views/template.php | 5 +++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/testing/tests/views/template_test.php b/testing/tests/views/template_test.php index 62e6846..dc1e7ce 100644 --- a/testing/tests/views/template_test.php +++ b/testing/tests/views/template_test.php @@ -23,11 +23,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase { private function _Render($template) { - ob_start(); - $template->Render(); - $data = ob_get_contents(); - ob_end_clean(); - return $data; + return $template->Render(); } public function testRenderSimple() diff --git a/views/template.php b/views/template.php index ede5723..12b69ef 100644 --- a/views/template.php +++ b/views/template.php @@ -83,7 +83,12 @@ class Template extract($_vars); eval('?>' . $_template . '<' . '?'); }; + + ob_start(); $render(); + $data = ob_get_contents(); + ob_end_clean(); + return $data; } /*! @brief Does any pre-processing on the template. -- 2.43.5