public function executeMobile($task = '') { CFactory::load('libraries', 'mobile'); $view =& $this->getView(JRequest::getCmd('view', 'frontpage')); // Fetch content ob_start(); if (!empty($task) && method_exists($this, $task)) { $this->{$task}(); } else { $this->display(); } $content = ob_get_contents(); ob_end_clean(); // Swap joomla document with // CDocumentMobile or CDocumentMobileAjax $document =& JFactory::getDocument(); if (JRequest::getCmd('section') == 'content') { $document = new CDocumentMobileAjax($document); echo $content; } else { $document = new CDocumentMobile($document); // Add our scripts & stylesheets CTemplate::addScript('script.mobile-1.0'); CTemplate::addScript('joms.ajax'); CTemplate::addStylesheet('style.mobile'); // Fetch toolbar ob_start(); $view->showToolbarMobile(); $toolbar = ob_get_contents(); ob_end_clean(); // Fetch switcher ob_start(); CMobile::showSwitcher(); $switcher = ob_get_contents(); ob_end_clean(); $tmpl = new CTemplate(); $tmpl->set('toolbar', $toolbar); $tmpl->set('content', $content); $tmpl->set('switcher', $switcher); echo $tmpl->fetch('mobile.index'); } }