wip handle puting files and var on front

This commit is contained in:
asus
2024-02-08 12:11:16 +01:00
parent ae5fa7191a
commit da5bb42a62
6 changed files with 72 additions and 34 deletions

View File

@@ -0,0 +1,29 @@
<?php
function template($file) {
$template_dir_path = plugin_dir_path(__DIR__).'html/templates/';
include($template_dir_path.$file);
}
# using ob_start() and ob_get_clean()
# allows to have php expansion inside the html loaded
# in opposition to the methode file_get_contents()
#
# https://stackoverflow.com/a/4402045/9497573
function create_html($files) {
$html_dir = plugin_dir_path(__DIR__).'html/';
$template_dir = plugin_dir_path(__DIR__).'html/templates/';
$names = ["hugo", "camille"];
ob_start();
foreach($files as $file) {
include($html_dir.$file);
}
$html = ob_get_clean();
return $html;
}
?>