1

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()

4

1 回答 1

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

于 2013-01-24T11:20:54.953 回答