diff options
author | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-30 14:08:48 +0000 |
---|---|---|
committer | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-10-30 14:08:48 +0000 |
commit | 53f65c2ef2b8fb4f3c80c31f68dc2436b45a5db7 (patch) | |
tree | 59a3c92808a5aefeac7ea0427e0dd3607dfb62bd /engine | |
parent | 1770180c274d981f2dcf8a4791753de54652f51b (diff) | |
download | elgg-53f65c2ef2b8fb4f3c80c31f68dc2436b45a5db7.tar.gz elgg-53f65c2ef2b8fb4f3c80c31f68dc2436b45a5db7.tar.bz2 |
Cleaning up logic regarding view error notices.
git-svn-id: http://code.elgg.org/elgg/trunk@3604 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/elgglib.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 4ac43e4de..154f801ac 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -257,13 +257,24 @@ function elgg_view($view, $vars = "", $bypass = false, $debug = false, $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. + // try to include view 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'); + // requested view does not exist + $error = "$viewtype/$view view does not exist."; + + // attempt to load default view + if ($viewtype != 'default') { + if (file_exists($default_view_file) && include($default_view_file)) { + // default view found + $error .= " Using default/$view instead."; + } else { + // no view found at all + $error = "Neither $viewtype/$view nor default/$view view exists."; + } } + + // log warning + elgg_log($error, 'WARNING'); } } |