Plumb in Matt's PHP template.
This commit is contained in:
28
pledge-update/page_renderer.php
Normal file
28
pledge-update/page_renderer.php
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user