diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-31 12:26:40 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-31 12:26:40 +0000 |
commit | 3dc7b6ff6bbcc7d885214a89d6fb3a5892fdf4b0 (patch) | |
tree | dc8fb9889d523e70cb068628fabd87ffe4125889 | |
parent | e19ac2a8d3333366502714469da5e6fd6c7752f5 (diff) | |
download | elgg-3dc7b6ff6bbcc7d885214a89d6fb3a5892fdf4b0.tar.gz elgg-3dc7b6ff6bbcc7d885214a89d6fb3a5892fdf4b0.tar.bz2 |
Introducing elgg_get_view_location()
git-svn-id: https://code.elgg.org/elgg/trunk@1626 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/elgglib.php | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 0f15e3092..2aabe5c36 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -120,6 +120,28 @@ return $viewtype; } + + /** + * Return the location of a given view. + * + * @param string $view The view. + */ + function elgg_get_view_location($view) + { + global $CONFIG; + + if (!isset($CONFIG->views->locations[$view])) { + if (!isset($CONFIG->viewpath)) { + return dirname(dirname(dirname(__FILE__))) . "/views/"; + } else { + return $CONFIG->viewpath; + } + } else { + return $CONFIG->views->locations[$view]; + } + + return false; + } /**
* Handles templating views
@@ -192,16 +214,8 @@ // Start the output buffer, find the requested view file, and execute it
ob_start();
foreach($viewlist as $priority => $view) {
-
- if (!isset($CONFIG->views->locations[$view])) {
- if (!isset($CONFIG->viewpath)) {
- $view_location = dirname(dirname(dirname(__FILE__))) . "/views/";
- } else {
- $view_location = $CONFIG->viewpath;
- }
- } else {
- $view_location = $CONFIG->views->locations[$view];
- } + + $view_location = elgg_get_view_location($view); if (file_exists($view_location . "{$viewtype}/{$view}.php") && !@include($view_location . "{$viewtype}/{$view}.php")) {
|