如何将我的 joomla 组件布局重定向到自定义布局。我一直在尝试以多种方式实现这一目标,但似乎没有奏效。我有我的控制器
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;
}
}
}
比以下 urlindex.php?option=com_mycomponent&task=getItem&layout=item&id=2571
应该调用控制器的 getItem 方法并在名为的自定义布局中输出结果item