JRequest::getCmd 弃用

use*_*610 2 joomla joomla2.5

我在文档中找不到如何在 joomla 2.5 中修改它(如果 JRequest::getCmd弃用)!

function propios(){
    $model = &$this->getModel(JRequest::getCmd('view'));
    $view  = &$this->getView(JRequest::getCmd('view'), 'html');
    $view->setModel($model, true);
    $view->hardwarePropio();
}
Run Code Online (Sandbox Code Playgroud)

任何想法!

最后我的控制是

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);
Run Code Online (Sandbox Code Playgroud)

如果我删除最后两行,视图中调用函数的链接将不起作用

<a href="<?php echo JURI::root()?>index.php/hardware/propios">Equipos propios</a>
Run Code Online (Sandbox Code Playgroud)

如何致电function hardwarePropio()

Irf*_*fan 5

而不是这个-

$model = &$this->getModel(JRequest::getCmd('view'));
$view  = &$this->getView(JRequest::getCmd('view'), 'html');
$view->setModel($model, true);
$view->hardwarePropio();
Run Code Online (Sandbox Code Playgroud)

你可以用这个——

$jinput   = JFactory::getApplication()->input;
$view     = $jinput->getCmd('view', 'hardwares');

$model = &$this->getModel($view);
$view  = &$this->getView($view,'html');
$view->setModel($model, true);
$view->hardwarePropio();
Run Code Online (Sandbox Code Playgroud)

API - http://doc.joomladev.eu/api25/Joomla-Platform/Application/JInput.html