From 9382df568df8d158d5eff367a4fbcb5cadf0e8d0 Mon Sep 17 00:00:00 2001 From: K Date: Tue, 31 Jul 2018 11:34:14 -0400 Subject: [PATCH] Add support for custom templates --- phplib/Notification.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/phplib/Notification.php b/phplib/Notification.php index f5cd9c1..38b6d09 100644 --- a/phplib/Notification.php +++ b/phplib/Notification.php @@ -345,8 +345,17 @@ public static function render($tpl, $vars, $debug_data=[]) { // Render the template. If there's an error, dump the output buffer. ob_start(); + $template_file_list = [ + sprintf('%s/exttemplates/%s.php', BASE_DIR, $tpl), + sprintf('%s/templates/%s.php', BASE_DIR, $tpl), + ]; try { - require(sprintf('%s/templates/%s.php', BASE_DIR, $tpl)); + foreach($template_file_list as $template_file) { + if(file_exists($template_file)) { + require($template_file); + break; + } + } } catch(\Exception $e) { ob_end_clean(); throw $e;