diff --git a/app/helpers/theme.php b/app/helpers/theme.php index 2ea227d..884b0c2 100644 --- a/app/helpers/theme.php +++ b/app/helpers/theme.php @@ -193,14 +193,19 @@ class Theme */ public static function include($template) { - $themeName = self::getCurrentThemeName(); - $config = self::getConfig(); + global $config; + $config = $config ?? []; + + $themeConfig = self::getConfig(); + $themeName = self::getCurrentThemeName(); - // Import all global variables into local scope // We need this here, otherwise because this helper // between index and the views breaks the session vars extract($GLOBALS, EXTR_SKIP | EXTR_REFS); + // Ensure config is always available in templates + $config = array_merge($config, $themeConfig); + // For non-default themes, look in the theme directory first if ($themeName !== 'default') { $themePath = $config['paths']['themes'] . '/' . $themeName . '/views/' . $template . '.php';