Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.