From 6ae0bee2fecbf841d1f9c8258ee70d17bd895b11 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 17 Jun 2019 10:16:27 -0700 Subject: [PATCH] Menu-Manager {MENU} count fix for *_layout.html format. --- e107_handlers/menumanager_class.php | 31 ++++++++++++++++++++++------- e107_handlers/theme_handler.php | 8 ++++++-- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php index 5a6262ddd..eb4e401dd 100644 --- a/e107_handlers/menumanager_class.php +++ b/e107_handlers/menumanager_class.php @@ -1992,8 +1992,8 @@ class e_menu_layout $CUSTOMHEADER = null; $CUSTOMFOOTER = null; - - $file = e_THEME.$theme."/theme.php"; + $path = e_THEME.$theme.'/'; + $file = $path."theme.php"; if(!is_readable($file)) { @@ -2029,9 +2029,28 @@ class e_menu_layout $head = array(); $foot = array(); - if(!isset($LAYOUT)) + // new v2.2.2 HTML layout support. + if(empty($LAYOUT) && is_dir($path."layouts")) { - $LAYOUT = e_theme::loadLayout(THEME_LAYOUT); + $lyt = scandir($path."layouts"); + $LAYOUT = array(); + + foreach($lyt as $lays) + { + if($lays === '.' || $lays === '..') + { + continue; + } + + $key = str_replace("_layout.html", '', $lays); + + if($lm = e_theme::loadLayout($key, $theme)) + { + $LAYOUT = $LAYOUT + $lm; + } + + } + } @@ -2217,12 +2236,10 @@ class e_menu_layout $text .= ""; - //TODO FIXME parse the theme file (or store it somewhere) to get the number of menu areas for each layout. ie. $menu_areas below. - $layouts = self::getLayouts(); $tp = e107::getParser(); - // $text .= print_a($layouts['menus'],true); + // var_dump($layouts['menus']); $text .= ' diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php index cfc82afd8..f9e3339f0 100644 --- a/e107_handlers/theme_handler.php +++ b/e107_handlers/theme_handler.php @@ -83,9 +83,12 @@ class e_theme * @param string $key layout name * @return array|bool */ - public static function loadLayout($key) + public static function loadLayout($key=null, $theme = null) { - $theme = e107::pref('core','sitetheme'); + if($theme === null) + { + $theme = e107::pref('core','sitetheme'); + } if(!is_readable(e_THEME.$theme."/layouts/".$key."_layout.html") || !is_readable(e_THEME.$theme."/theme.html")) { @@ -104,6 +107,7 @@ class e_theme return $LAYOUT; } + /** * Load library dependencies. *