2011-02-25 00:45:29 +02:00
|
|
|
<?php defined('SYSPATH') or die('No direct script access.');
|
|
|
|
|
2011-02-25 01:34:41 +02:00
|
|
|
abstract class Kohana_Kostache_Layout extends Kostache {
|
2011-02-25 00:45:29 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string partial name for content
|
|
|
|
*/
|
|
|
|
const CONTENT_PARTIAL = 'content';
|
|
|
|
|
2011-02-25 17:59:43 +02:00
|
|
|
/**
|
|
|
|
* @var boolean render template in layout?
|
|
|
|
*/
|
|
|
|
public $render_layout = TRUE;
|
|
|
|
|
2011-02-25 00:45:29 +02:00
|
|
|
/**
|
|
|
|
* @var string layout path
|
|
|
|
*/
|
|
|
|
protected $_layout = 'layout';
|
|
|
|
|
|
|
|
public function render()
|
|
|
|
{
|
2011-02-25 17:59:43 +02:00
|
|
|
if ( ! $this->render_layout)
|
2011-02-25 00:45:29 +02:00
|
|
|
{
|
|
|
|
return parent::render();
|
|
|
|
}
|
|
|
|
|
|
|
|
$partials = $this->_partials;
|
|
|
|
|
|
|
|
$partials[Kostache_Layout::CONTENT_PARTIAL] = $this->_template;
|
|
|
|
|
|
|
|
$template = $this->_load($this->_layout);
|
|
|
|
|
|
|
|
return $this->_stash($template, $this, $partials)->render();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|