sealandia-framework/framework/template.php

25 lines
598 B
PHP

<?php
class Template{
/**
* Method to render the template file with additional data
*/
public function render($tmpname, $args){
/**
* Extracts variables from the associative array $args, making each key a variable in the current scope.
* EXTR_SKIP ensures that existing variables with the same name are not overwritten.
* Then Include the specified view file for rendering.
*/
extract($args, EXTR_SKIP);
require "views/{$code}.view.php";
}
}
// $templ = Template::render('about', '['title' => 'About']');
?>