diff options
-rw-r--r-- | engine/lib/elgglib.php | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 2eecfefb6..4ac43e4de 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -238,7 +238,6 @@ function elgg_view($view, $vars = "", $bypass = false, $debug = false, $viewtype } } - // Get the current viewtype if (empty($viewtype)) { $viewtype = elgg_get_viewtype(); @@ -256,27 +255,16 @@ function elgg_view($view, $vars = "", $bypass = false, $debug = false, $viewtype foreach($viewlist as $priority => $view) { $view_location = elgg_get_view_location($view, $viewtype); $view_file = "$view_location$viewtype/$view.php"; + $default_view_file = "{$view_location}default/$view.php"; // try to include view, defaulting to 'default' view if error. - - if (file_exists($view_file) && !include($view_file)) { - $success = false; - - if ($viewtype != "default") { - $default_view_file = "{$view_location}default/$view.php"; - if (file_exists($default_view_file) && include($default_view_file)) { - $success = true; - } - } - - if (!$success) { - elgg_log("The view $view could not be included", 'WARNING'); + if (!file_exists($view_file) || !include($view_file)) { + if ($viewtype != 'default' && file_exists($default_view_file) && include($default_view_file)) { + elgg_log("$viewtype/$view view does not exist. Using default/$view instead.", 'WARNING'); + } else { + elgg_log("Neither $viewtype/$view nor default/$view view exists.", 'WARNING'); } - - } else if (!file_exists($view_file)) { - elgg_log("The view $view does not exist", 'WARNING'); } - } // Save the output buffer into the $content variable |