tags:

views:

530

answers:

2

I am developing a custom component in joomla while trying to use MVC.

How do I call a model from a view?

+4  A: 

In MVC you don't. That's the whole point of it.

At most you call a function of the controller which calls a function of the model. Or you let your controller set up a connection between the model and the view.

Georg
A: 

When your JView class is loaded, the JModel class with a matching name is automatically loaded by Joomla. When you call $this->get('Data') within your JView class code, it will call the getData() function in your JModel class, which should return the data you want to use.

jlleblanc