Changed render method to take a layout parameter.

pull/11/head
Mike Cao 14 years ago
parent 853155b759
commit d5c696a969

@ -41,6 +41,13 @@ class Flight {
*/ */
protected static $instances = array(); protected static $instances = array();
/**
* Autoload directories.
*
* @var array
*/
protected static $dirs = array();
// Don't allow object instantiation // Don't allow object instantiation
private function __construct() {} private function __construct() {}
private function __destruct() {} private function __destruct() {}
@ -521,11 +528,14 @@ class Flight {
* *
* @param string $file Template file * @param string $file Template file
* @param array $data Template data * @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) { public static function _render($file, $data = null, $layout = null, $key = 'content') {
if ($key !== null) { if ($layout !== null) {
self::set($key, self::view()->fetch($file, $data)); $content = self::view()->fetch($file, $data);
self::view()->render($layout, array($key => $content));
} }
else { else {
self::view()->render($file, $data); self::view()->render($file, $data);

Loading…
Cancel
Save