我没有在文档中找到如果JRequest::getCmd
弃用,如何在joomla 2.5中修改此内容
function propios(){
$model = &$this->getModel(JRequest::getCmd('view'));
$view = &$this->getView(JRequest::getCmd('view'), 'html');
$view->setModel($model, true);
$view->hardwarePropio();
}
任何想法!
最后我的控制权是
class HardwareController extends JController
{
// busca los hardwares propios
function propios(){
$jinput = JFactory::getApplication()->input;
$view = $jinput->getCmd('view', 'hardwares');
JFactory::getApplication()->input->set('view', $view);
$model = &$this->getModel($view);
$view = &$this->getView($view, 'html');
$view->setModel($model, true);
$view->$view->hardwarePropio();
}
$view = JFactory::getApplication()->input->getCmd('view', 'hardwares');
JFactory::getApplication()->input->set('view', $view);
如果我删除最后两行,则视图中用于调用函数的链接不起作用
<a href="<?php echo JURI::root()?>index.php/hardware/propios">Equipos propios</a>
如何致电function hardwarePropio()
答案 0 :(得分:3)
而不是这个 -
$model = &$this->getModel(JRequest::getCmd('view'));
$view = &$this->getView(JRequest::getCmd('view'), 'html');
$view->setModel($model, true);
$view->hardwarePropio();
你可以使用它 -
$jinput = JFactory::getApplication()->input;
$view = $jinput->getCmd('view', 'hardwares');
$model = &$this->getModel($view);
$view = &$this->getView($view,'html');
$view->setModel($model, true);
$view->hardwarePropio();
API - http://doc.joomladev.eu/api25/Joomla-Platform/Application/JInput.html