user852610
user852610

Reputation: 2265

JRequest::getCmd deprecate

I dont find in the documentation How to modified this in joomla 2.5 if JRequest::getCmd deprecate!!

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

any idea!

finally my control is

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

If I erase the last two line, the link in the view to call a function dont work

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

How to call the function hardwarePropio()

Upvotes: 2

Views: 4041

Answers (1)

Irfan
Irfan

Reputation: 7059

Instead of this-

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

You can use this-

$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

Upvotes: 5

Related Questions