So I have a subcontroller extending JControllerForm that handles the edit view of an item in my component.

As part of this I'd like to render some associated items, which come from a different DB table and are associated in a 1-M relationship with that table.

How can I add that model in JControllerForm so that it's ready for use in view.html.php?

The only real solution I've seen is to have a switch statement in the master controller display() method to identify the view and add models at that point, but it strikes me with all these subcontrollers that some method must be overrideable?

1 Answer 1


I use this snippet directly on view.html.php:

$model = $this->getModel('NameOfModel','NameOfComponent', array('ignore_request' => false));
$model->myMethod(yourparam1, yourparam2 etc);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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