Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

throw exceptions if twig isn't setup

  • Loading branch information...
commit 9108412db12d6938f75cb3e23351f741f27e6d09 1 parent 7ab5d8d
Ryan Mark ryanmark authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 shortcuts.php
5 shortcuts.php
View
@@ -10,6 +10,7 @@
use mtv\http\Http500;
use mtv\http\AjaxHttp500;
use mtv\models\wp\PostCollection;
+use Exception;
/**
* Render and display a template
@@ -17,6 +18,8 @@
function display_template( $template_name, $context=array() ) {
global $twig;
+ if ( !is_object($twig) ) throw new Exception('Twig template engine not available');
+
$template = $twig->loadTemplate( $template_name );
$template->display( $context );
}
@@ -27,6 +30,8 @@ function display_template( $template_name, $context=array() ) {
function render( $template_name, $context=array() ) {
global $twig;
+ if ( !is_object($twig) ) throw new Exception('Twig template engine not available');
+
$template = $twig->loadTemplate( $template_name );
return $template->render( $context );
}
Please sign in to comment.
Something went wrong with that request. Please try again.