From 6d567a74a4a3deb0b0260867d34026195bdf2749 Mon Sep 17 00:00:00 2001 From: alextselegidis Date: Tue, 9 Nov 2021 08:39:30 +0100 Subject: [PATCH] Added new layout method to the loader --- application/core/EA_Loader.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/application/core/EA_Loader.php b/application/core/EA_Loader.php index 14d49e42..3547a47b 100644 --- a/application/core/EA_Loader.php +++ b/application/core/EA_Loader.php @@ -40,5 +40,20 @@ * @property EA_URI $uri */ class EA_Loader extends CI_Loader { - // + /** + * Loads "layout" files. + * + * @param string $layout + * @param string $template + * @param array $vars An associative array of data to be extracted for use in the view + * @param bool $return Whether to return the view output or leave it to the Output class + * + * @return object|string + */ + public function layout(string $layout, string $template, array $vars = [], bool $return = FALSE) + { + $vars['template'] = APPPATH . 'views/' . $template . '.php'; + + return $this->view($layout, $vars, $return); + } }