| @@ -17,8 +17,9 @@ | ||
| 17 | 17 | protected $template_dir; |
| 18 | 18 | |
| 19 | 19 | public function __construct( $template_dir ) { |
| 20 | 20 | $this->template_dir = $template_dir; |
| 21 | + | |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | /** |
| 24 | 25 | * @param string $template_dir |
| @@ -47,15 +48,20 @@ | ||
| 47 | 48 | * |
| 48 | 49 | * @return false|string |
| 49 | 50 | */ |
| 50 | 51 | public function render_to_string( $template_name, array $data = [] ) { |
| 51 | - $path = sprintf( '%s/%s.php', $this->template_dir, $template_name ); | |
| 52 | 52 | |
| 53 | + error_reporting( E_ALL ); | |
| 54 | + | |
| 55 | + $path = sprintf( '%s/%s.php', $this->template_dir, $template_name ); | |
| 56 | + | |
| 53 | 57 | ob_start(); |
| 58 | + | |
| 54 | 59 | extract( $data ); |
| 60 | + | |
| 55 | 61 | include( $path ); |
| 62 | + | |
| 56 | 63 | $output = ob_get_clean(); |
| 57 | - | |
| 58 | 64 | return $output; |
| 59 | 65 | } |
| 60 | 66 | |
| 61 | 67 | /** |