public function render($context) { $template = new Shine($this->template_path); if (!is_null($this->template_path)) { return $template->render($context); } else { return ''; } }
/** * @see Shine_Node_Abstract::render() */ public function render($context) { $resolved_vars = array(); foreach ($this->vars_to_resolve as $var) { $resolved_vars[] = $var->resolve($context); } $dict = call_user_func_array($this->func, $resolved_vars); $t = new Shine($this->template); return $t->render($dict); }
public function display($file) { require_once 'Shine.php'; $template_path = ROOT_PATH . '/themes'; $config = array('enableCache' => false, 'defaultContext' => array('foobar' => 'abcd')); Shine::setTemplate($template_path, $config); Shine::addPlugin('customtags'); $shine = new Shine($file); echo $shine->render($this->context); }
public static function load($parser, $token) { $bits = self::split($token->contents); foreach (array_slice($bits, 1) as $taglib) { try { if (strpos($taglib, '.')) { $tmp = explode('.', $taglib); foreach ($tmp as &$val) { $val = ucfirst(strtolower($val)); } $classname = implode(DIRECTORY_SEPARATOR, $tmp); } else { $classname = ucfirst(strtolower($taglib)); } try { Shine::loadTag($classname); } catch (Shine_Exception $e) { throw new Shine_Exception_InvalidTemplateLibrary(); } $lib = new $classname(); $parser->addLibrary($lib); } catch (Shine_Exception_InvalidTemplateLibrary $e) { throw new Shine_Exception_SyntaxError("'{$taglib}' is not a valid tag library"); } } return new Shine_Node_Load(); }
/** * 修改模板文件后缀 * * @param string $name 第一个字符必须是. * @return void */ public static function setTemplateSuffix($name) { if (isset($name[0]) && $name[0] === '.') { self::$_templateSuffix = $name; self::$_templateSuffixCount = -strlen($name); } }
public function render($context) { $template_name = $this->template_name->resolve($context); $t = new Shine($template_name); return $t->render($context); }