public function action($path, \Closure $callback) { if ($path == $this->route) { $jade = new Jade(); $vars = $callback($path) ?: []; $jade->render($path . '.jade', $vars); } }
<?php namespace Jade; require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../src/Jade/Jade.php'; $jade = new Jade('/tmp', true); $html = $jade->render('index.jade'); echo $html;
<?php require './work.php'; require './lib/Node.php'; require './lib/Dumper.php'; require './lib/Lexer.php'; require './lib/Parser.php'; require './Jade.php'; $jade = new Jade(); echo $jade->render('sample1.jade'); echo PHP_EOL; echo $jade->render('sample2.jade');
/** * Fetch rendered template * * @param string $template Template pathname relative to templates directory * @param array $data Associative array of template variables * * @return string */ public function fetch($template, $data = []) { $data = array_merge($this->defaultVariables, $data); return $this->jade->render($this->path . $template . '.jade', $data); }
<?php namespace Jade; require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../src/Jade/Jade.php'; $jade = new Jade('/tmp', true); $title = "Hello World"; $header = "this is append"; require $jade->cache('index.jade');