php_engine/app/view/View.php
2025-01-20 19:54:53 +03:00

20 lines
479 B
PHP

<?php
define('FOLDER_TEMPLATE', __DIR__ .'/../template/');
class View {
static function render( $data, $tpl ) {
extract($data);
// Start output buffering
ob_start();
// Include the template file
include FOLDER_TEMPLATE . $tpl;
// Get the contents of the buffer
$content = ob_get_contents();
// End output buffering and erase the buffer's contents
ob_end_clean();
return $content;
}
}