diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-03-04 10:54:17 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-03-04 10:54:17 +0000 |
commit | 12beb0e6ca3d8c1a72855a7fd61481cf2f6db22b (patch) | |
tree | 7d0d4371100e73aa982de875c56953d6f74381ba /engine/lib/elgglib.php | |
parent | 6172577d65ed2fa82c07c92c032e7aa727ffabeb (diff) | |
download | elgg-12beb0e6ca3d8c1a72855a7fd61481cf2f6db22b.tar.gz elgg-12beb0e6ca3d8c1a72855a7fd61481cf2f6db22b.tar.bz2 |
Improvements to elgg_view, plus river dashboard RSS feed
git-svn-id: https://code.elgg.org/elgg/trunk@3053 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r-- | engine/lib/elgglib.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 379c4e543..8f3196482 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -228,10 +228,11 @@ * @param string $view The name and location of the view to use * @param array $vars Any variables that the view requires, passed as an array * @param boolean $bypass If set to true, elgg_view will bypass any specified alternative template handler; by default, it will hand off to this if requested (see set_template_handler) - * @param boolean $debug If set to true, the viewer will complain if it can't find a view + * @param boolean $debug If set to true, the viewer will complain if it can't find a view
+ * @param string $viewtype If set, forces the viewtype for the elgg_view call to be this value (default: standard detection) * @return string The HTML content */ - function elgg_view($view, $vars = "", $bypass = false, $debug = false) { + function elgg_view($view, $vars = "", $bypass = false, $debug = false, $viewtype = '') { global $CONFIG; static $usercache; @@ -286,8 +287,9 @@ } - // Get the current viewtype - $viewtype = elgg_get_viewtype(); + // Get the current viewtype
+ if (empty($viewtype)) + $viewtype = elgg_get_viewtype(); // Set up any extensions to the requested view if (isset($CONFIG->views->extensions[$view])) { @@ -313,7 +315,6 @@ foreach($viewlist as $priority => $view) { $view_location = elgg_get_view_location($view); - if (file_exists($view_location . "{$viewtype}/{$view}.php") && !include($view_location . "{$viewtype}/{$view}.php")) { $success = false; @@ -352,15 +353,17 @@ /** * Returns whether the specified view exists * - * @param string $view The view name + * @param string $view The view name
+ * @param string $viewtype If set, forces the viewtype * @return true|false Depending on success */ - function elgg_view_exists($view) { + function elgg_view_exists($view, $viewtype = '') { global $CONFIG; - // Detect view type - $viewtype = elgg_get_viewtype(); + // Detect view type
+ if (empty($viewtype)) + $viewtype = elgg_get_viewtype(); if (!isset($CONFIG->views->locations[$viewtype][$view])) { if (!isset($CONFIG->viewpath)) { |