duangan7834 2015-03-10 11:46
浏览 56
已采纳

无法从控制器调用get Model

I'm developing a component for Joomla 3.x and I'm having a problem with JControllerLegacy getModel. When I try to call it from within my controller.php in the dispaly function of the class CasehandlerController it breaks execution with no erorrs, just a blank page, as if the function was undefined. The very same code works fine on my local developement server but on the production server it fails when making this call. The function is as below:

    function display($cachable = false, $urlparams = false) 
    {
        $this->configuration = getConfiguration();
        // set default view if not set
        $input = JFactory::getApplication()->input;
        $input->set('view', $input->getCmd('view', 'Casehandler'));
        $view = $this->getView( $input->get('view'), 'html' );
        echo 'model:';
        $model = $this->getModel('Casehandler');// closing single quote missing here

        echo 'model done.';
        $view->setModel($model, true );
        $view->setLayout( 'default' );
        $view->display();
    }

"model:" gets echoed and "model done." does not. I've tried to debug this by echoing lines from inside the model class but with no response from that either. Calling getModel() without arguments also produces the same result. What could be the problem here when the exact same code runs fine on my local server?

  • 写回答

1条回答 默认 最新

  • duangeli1334 2015-03-10 13:43
    关注

    Having debugged this further by echoing lines from the JControllerLegacy class inside the getModel function I got a hint from the $prefix variable displaying the model name as casehandlerModel instead of CasehandlerModel, changed the filename of the model from casehandler.php to Casehandler.php and that fixed the problem...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突