added switch on off for server console log
This commit is contained in:
25
plugins/wp_model_plugin/utils/create_html.php
Normal file
25
plugins/wp_model_plugin/utils/create_html.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
# 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
|
||||
|
||||
# takes two arguments :
|
||||
# a list of the html files to include in front
|
||||
# a list of variables to make available to this files
|
||||
function create_html($files, $vars) {
|
||||
$html_dir = plugin_dir_path(__DIR__).'html/';
|
||||
extract($vars);
|
||||
|
||||
ob_start();
|
||||
foreach($files as $file) {
|
||||
include($html_dir.$file);
|
||||
}
|
||||
$html = ob_get_clean();
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user