24 lines
619 B
PHP
24 lines
619 B
PHP
<?php
|
|
define('FOLDER_TEMPLATE', './template/');
|
|
include "model_box.php";
|
|
|
|
function render($tpl, $data ) {
|
|
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;
|
|
}
|
|
|
|
$value = ['box'=> $box , 'title'=> "New Year!",
|
|
'body' => "God save the king! Happy new year!!",
|
|
'auth' => true ];
|
|
$portial = render('tpl_layout.php', $value );
|
|
echo $portial;
|
|
|