/** * Constructs this object to use the given template. The .html.php * extension is optional. * * @param string */ public function __construct($template) { if (file_exists($template)) { $this->path = $template; } else { $this->path = "{$_SERVER['DOCUMENT_ROOT']}/{$this->templates_path}/" . LayoutHelper::extensionize($template, 'html.php'); } }
/** * Renders a template in the current directory named like a Rails * partial template. For example, if $partial were the string * "subnav", this method would attempt to render a template named * "_subnav.html.php". * * Currently, the partial must be in the current directory. * * Returns the same thing as render(). * * @param string * @return string */ public function render_partial($partial) { $basename = preg_replace('/^_/', '', basename($partial)); $path = '_' . LayoutHelper::extensionize($basename, 'html.php'); return $this->render($path); }