From 12beb0e6ca3d8c1a72855a7fd61481cf2f6db22b Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 4 Mar 2009 10:54:17 +0000 Subject: Improvements to elgg_view, plus river dashboard RSS feed git-svn-id: https://code.elgg.org/elgg/trunk@3053 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'engine/lib') 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)) { -- cgit v1.2.3