getTemplateSources($template_name, $template_dirs) as $filepath) { try { return array(file_get_contents($filepath), $filepath); } catch (\ErrorException $e) { $tried[] = $filepath; } } if (!empty($tried)) $error_msg = 'Tried '.implode(', ', $tried); else $error_msg = 'Your TEMPLATE_DIRS setting is empty. Change it '. 'to point to at least one template directory.'; throw new TemplateDoesNotExist($error_msg); } }