From 84b8eeb044f0739c4a4b077aeeb4724fad934ed7 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 11 May 2011 14:17:47 -0700 Subject: [PATCH] Allow rendered content to be saved into a variable --- flight/Flight.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flight/Flight.php b/flight/Flight.php index 855a8d1..086df8b 100644 --- a/flight/Flight.php +++ b/flight/Flight.php @@ -518,9 +518,15 @@ class Flight { * * @param string $file Template file * @param array $data Template data + * @param string $key Key name */ - public static function _render($file, $data = null) { - self::view()->render($file, $data); + public static function _render($file, $data = null, $key = null) { + if ($key !== null) { + self::set($key, self::view()->fetch($file, $data)); + } + else { + self::view()->render($file, $data); + } } /**