How can I redirect my joomla components layout to a custom layout. I have been trying to achieve this in couple of ways but doesn't seems to work. I have my controller
class FrontpageController extends JController {
protected $id;
protected $input;
function __construct($config = array()) {
$this->input = JFactory::getApplication()->input;
parent::__construct($config);
}
public function display($cachable = false, $urlparams = array()) {
// Initialise variables.
$this->input = JFactory::getApplication()->input;
$cachable = true;
// Set the default view name and format from the Request.
$viewName = $this->input->get('view', 'frontpage');
$this->input->set('view', $viewName);
return parent::display($cachable, $safeurlparams);
}
public function getItem() {
// Initialise variables.
$item = $this->getModel('item');
$this->input->set('view','item');
if (!item) {
JLog::add(implode('<br />', $errors), JLog::WARNING, 'jerror');
return false;
return $item;
}
}
}
than the following url index.php?option=com_mycomponent&task=getItem&layout=item&id=2571
should call the controllers getItem method and output the results in a custom layout called item