This isn't a question about getting model data into another view. I can create a huge form with data from multiple models. But, is that necessary? Can a model display its view within the context of another view (similar to an object displaying itself)? If so, how?
Not by default, no. The model and the view basically don't talk to each other at all, all interaction between them is handled by the controllers. The reason the model is attached to the view is because it gets set as a property in the JControllerLegacy::display() method.
The model stores its associated view name as a string in its 'name' property, but it's not much use on its own as models don't have a display() method. Here's how a display task works:
- When it's time to display a page _GET has 'task' set to 'display' and 'view' set to whatever view you're going to.
- Your component's root .php file gets your root controller.php (which extends JControllerLegacy) and executes the method corresponding to __GET's 'task' value, yourController::display().
- yourController::display() gets the view class using __GET's 'view' property.
- yourController::display() uses the view class' name to get the associated model class and sets it as a view class property.
- yourController::display() executes yourView::display().
- yourView::display() does its thing and outputs its template.
You could override JControllerLegacy::display() in yourController::display() then also set the view as a property of the model, but you're better off chaining views' display methods instead.