1
votes

I am now building my first joomla component.

I have 3 tables in it: __questions __resaults __display

I also need the Joomla user table:

__users

I have a single view: view.questions.html

this view gets data and also needs some database functions. It needs to:

  1. Get information from the user table.
  2. Get information from the resaults table
  3. Get information from the display table
  4. -SET- information to the reaults table

Now, I know Joomla is built with MVC architecture. This, I assume, means no dealing with database in views.

Where should I store the database hendling functions, and how can I call them in the front end?

The function dealing with questions is in the question view model, no problem, but what about the other tables? Should I put the functions dealing with them in the question model as well, the helper file, or make models for each other table, and call them from the question view? If i should make other models, how do I call them from the question view?

Thank you very much for your help!

2
have you not read the Joomla documentation on how to create a basic component. It explains things like this ;)Lodder
view.questions.html does not look like a valid view to me. it should be more like view.html.phpValentin Despa
I have read it all, it took me around 20 hours to understand it, as I am a novice. This part was a little messy in my mind - and there fore I asked it.Penance

2 Answers

1
votes

Create a model for each table. You will then instantiate them from the controller to make them available to the views.

0
votes

You can save a lot of time and also learn a lot by using the Component Creator: http://www.notwebdesign.com/joomla-component-creator/ It will do all the MVC stuff for you.