1

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 display function of the class CasehandlerController it breaks execution with no errors, just a blank page, as if the function was undefined.

The exact 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

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.

Changing the filename of the model from casehandler.php to Casehandler.php was the fix to the problem...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.