Skip to content

Instantly share code, notes, and snippets.

@imvision
Created June 4, 2014 07:14
Show Gist options
  • Save imvision/9136a1bdb32be9cc8f5b to your computer and use it in GitHub Desktop.
Save imvision/9136a1bdb32be9cc8f5b to your computer and use it in GitHub Desktop.
PHP Micro Templating
<?php
/**
* PHP Micro Templating
*/
namespace imvision;
class Template {
public static function Render($tmpl, $data = array()) {
extract($data);
ob_start();
if(file_exists($tmpl)) {
include $tmpl;
}
return ob_get_clean();
}
}
//Example usage
/*
include 'tmpl.php';
echo \imvision\Template::Render("content.html");
echo \imvision\Template::Render("content.html", $data_array);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment