// Get HMVC controller and if exists, execute it. $controller = KunenaControllerApplication::getInstance($view, $subview, $task, $input, $app); if ($controller) { KunenaRoute::cacheLoad(); $contents = $controller->execute(); KunenaRoute::cacheStore(); } elseif (is_file(KPATH_SITE . "/controllers/{$view}.php")) { // Execute old MVC. // Legacy support: If the content layout doesn't exist on HMVC, load and execute the old controller. $controller = KunenaController::getInstance(); KunenaRoute::cacheLoad(); ob_start(); $controller->execute($task); $contents = ob_get_clean(); KunenaRoute::cacheStore(); $controller->redirect(); } else { // Legacy URL support. $uri = KunenaRoute::current(true); if ($uri) { // FIXME: using wrong Itemid JFactory::getApplication()->redirect(KunenaRoute::_($uri, false)); }