From d5c696a9694d8587363eb2357936a889d648df2d Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Mon, 29 Aug 2011 21:14:42 -0700 Subject: [PATCH] Changed render method to take a layout parameter. --- flight/Flight.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/flight/Flight.php b/flight/Flight.php index 9980132..6521c49 100644 --- a/flight/Flight.php +++ b/flight/Flight.php @@ -41,6 +41,13 @@ class Flight { */ protected static $instances = array(); + /** + * Autoload directories. + * + * @var array + */ + protected static $dirs = array(); + // Don't allow object instantiation private function __construct() {} private function __destruct() {} @@ -521,11 +528,14 @@ class Flight { * * @param string $file Template file * @param array $data Template data - * @param string $key Key name + * @param string $layout Layout file + * @param string $key Content variable name */ - public static function _render($file, $data = null, $key = null) { - if ($key !== null) { - self::set($key, self::view()->fetch($file, $data)); + public static function _render($file, $data = null, $layout = null, $key = 'content') { + if ($layout !== null) { + $content = self::view()->fetch($file, $data); + + self::view()->render($layout, array($key => $content)); } else { self::view()->render($file, $data);