gpt4 book ai didi

joomla - JRequest::getCmd 弃用

转载 作者:行者123 更新时间:2023-12-02 22:15:47 24 4
gpt4 key购买 nike

如果 JRequest::getCmd deprecate!!

我没有在文档中找到 How to modified this in 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);

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

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

如何调用函数hardwarePropio()

最佳答案

而不是这个-

$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

关于joomla - JRequest::getCmd 弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14499810/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com