Skip to content

Instantly share code, notes, and snippets.

@israelst
Created November 5, 2011 00:27
Show Gist options
  • Save israelst/1340868 to your computer and use it in GitHub Desktop.
Save israelst/1340868 to your computer and use it in GitHub Desktop.
Templating PHP
<?php
function apply_template($template_path, $vars = array()){
ob_start();
extract($vars);
include($template_path);
$ob_contents = ob_get_contents();
ob_end_clean();
return $ob_contents;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment