Skip to content

Commit

Permalink
updated to work with latest revision
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenvanvliet committed Jul 9, 2008
1 parent 8ba4a25 commit 09c255d
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ class Layout_Core {

protected $layout='layouts/layout';

protected $layout_view;
protected $view;

protected $render_layout=TRUE;
protected $render_layout=true;
/**
* Singleton instance
* @return object singleton instance
* @param $layout Object[optional]
*/
public static function instance($layout=FALSE)
public static function instance($layout=false)
{
if(is_null(self::$instance))
{
Expand All @@ -32,7 +32,7 @@ private function __construct($layout)

Event::add('system.post_controller',array($this,'render'));

$this->layout_view=new View;
$this->view=new View;
Kohana::$instance->view=new View;

}
Expand All @@ -52,9 +52,9 @@ public function render()

if($this->render_layout==true)
{
$this->layout_view->set_filename($this->layout);
$this->layout_view->content=Kohana::$instance->view;
$this->layout_view->render(true);
$this->view->set_filename($this->layout);
$this->view->content=Kohana::$instance->view;
$this->view->render(true);
}
else
{
Expand All @@ -72,7 +72,7 @@ public function render()
*/
public function view_path()
{
return (Router::$controller_path.Router::$controller.'/'.Router::$method);
return (Router::$controller_dir.'/'.Router::$controller.'/'.Router::$method);
}
/**
* calls render()
Expand All @@ -86,7 +86,7 @@ public function __toString()
/**
* Magic __get method
* @return mixed
* @param $name
* @param $name Object
*/
public function __get($name)
{
Expand All @@ -100,14 +100,14 @@ public function __get($name)
}
else
{
return $this->layout_view->$name;
return $this->view->$name;
}
}
/**
* Magic __set method
* @return
* @param $name
* @param $value
* @param $name Object
* @param $value Object
*/
public function __set($name,$value)
{
Expand All @@ -121,22 +121,8 @@ public function __set($name,$value)
}
else
{
$this->layout_view->$name=$value;
$this->view->$name=$value;
}
}
/**
* Disable layout
*/
public function disable_layout()
{
$this->render_layout=false;
}
/**
* Enable layout
*/
public function enable_layout()
{
$this->render_layout=true;
}
}

0 comments on commit 09c255d

Please sign in to comment.