Skip to content

Instantly share code, notes, and snippets.

@barnabywalters
Created November 21, 2013 20:57
Show Gist options
  • Save barnabywalters/7589497 to your computer and use it in GitHub Desktop.
Save barnabywalters/7589497 to your computer and use it in GitHub Desktop.
Dumbest PHP template rendering function ever
<?php
function renderTemplate($template, array $__templateData = array()) {
$render = function ($__path, $render=null) use ($__templateData) {
ob_start();
extract($__templateData);
unset($__templateData);
include __DIR__ . '/../templates/' . $__path . '.php';
return ob_get_clean();
};
return $render($template, $render);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment