Create a php version of page template

This commit is contained in:
2024-07-30 23:00:02 +10:00
parent a75f4ca936
commit cd9135e3bd
6 changed files with 145 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
class SPLPageRenderer {
public function renderCouncilPage($config) {
ob_start();
set_error_handler(function($errno, $errstr, $errfile, $errline) {
// Clear any output if an error occurred
ob_get_clean();
error_log("Error: $errstr in $errfile on line $errline");
return true; // Prevent default error handling
});
require "template.php";
restore_error_handler();
$content = ob_get_clean();
// Explictly return null if we didn't generate any content
if (!empty($content)) {
return $content;
} else {
return null;
}
}
}