aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-27 13:54:55 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-27 13:54:55 +0000
commit5215adb98de2ae79bbc296c565225203e8181637 (patch)
treeef08b2222642a0204d349cf653b364d2fcd90f9e
parent6f368445a5a8f752dcdbafe229921b5723dc805f (diff)
downloadelgg-5215adb98de2ae79bbc296c565225203e8181637.tar.gz
elgg-5215adb98de2ae79bbc296c565225203e8181637.tar.bz2
Fixes #1161: Views now default to 'default' if not found.
git-svn-id: http://code.elgg.org/elgg/trunk@3585 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/elgglib.php24
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