Created
April 22, 2009 08:41
-
-
Save riaf/99666 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Ethna_Renderer_Mumu.php | |
* | |
* @author riaf <[email protected]> | |
* @package Ethna | |
* @version $Id$ | |
*/ | |
require_once 'mumu.php'; | |
/** | |
* Mumuレンダラクラス | |
* | |
* @author riaf <[email protected]> | |
* @access public | |
* @package Ethna | |
*/ | |
class Ethna_Renderer_Mumu extends Ethna_Renderer | |
{ | |
/** | |
* Ethna_Renderer_Mumuクラスのコンストラクタ | |
* | |
* @access public | |
*/ | |
function Ethna_Renderer_Mumu(&$controller){ | |
parent::Ethna_Renderer($controller); | |
$this->template_dir = $controller->getTemplatedir(); | |
if($this->template_dir{strlen($this->template_dir) - 1} != "/"){ | |
$this->template_dir .= '/'; | |
} | |
} | |
/** | |
* ビューを出力する | |
* | |
* @param string $template テンプレート名 | |
* @param bool $capture true ならば出力を表示せずに返す | |
* | |
* @access public | |
*/ | |
function perform($template = null, $capture = false){ | |
if ($template === null && $this->template === null) { | |
return Ethna::raiseWarning('template is not defined'); | |
} | |
if ($template !== null) { | |
$this->template = $template; | |
} | |
// テンプレートの有無のチェック | |
if (is_readable($this->template_dir. $this->template) === false) { | |
return Ethna::raiseWarning("template is not found: ". $this->template); | |
} | |
$mumu = MuParser::parse_from_file($this->template_dir. $this->template); | |
if ($capture === true) { | |
return $mumu->render($this->prop); | |
} else { | |
echo $mumu->render($this->prop); | |
return true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment