Plumb in Matt's PHP template.

This commit is contained in:
Kim Taylor
2024-09-17 22:19:24 +10:00
parent 1412c268b5
commit 2e444113c8
3 changed files with 235 additions and 21 deletions

View File

@@ -0,0 +1,28 @@
<?php
class SPLPageRenderer {
public function renderPledgePage($config, $candidates, $media) {
ob_start();
$didError = false;
set_error_handler(function($errno, $errstr, $errfile, $errline) use(&$didError) {
$didError = true;
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 or if there was an error
if (!empty($content) && !$didError) {
return $content;
} else {
return null;
}
}
}