Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function theme($template_file, $v = array()) {
- if (!file_exists("./$template_file")) {
- return "[$template_file does not exist]";
- }
- if (is_array($v)) {
- extract($v, EXTR_SKIP); // Extract the variables to a local namespace
- }
- ob_start(); // Start output buffering
- include "./$template_file"; // Include the template file
- $contents = ob_get_contents(); // Get the contents of the buffer
- ob_end_clean(); // End buffering and discard
- return $contents; // Return the contents
- }
Add Comment
Please, Sign In to add comment