MVC confusion

Have a programming question regarding your component, plug-in, extension or core hacks? Have an interesting tidbit, FAQ or programming tip you’d like to share? This is the place for you.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Post Reply
User avatar
madsamurai
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Oct 02, 2007 6:13 pm

MVC confusion

Post by madsamurai » Tue Nov 06, 2007 7:18 pm

I'm trying to develop my first Joomla component, and am developing for 1.5. I've been thru the tutorials on the 1.5 MVC model, and am getting confused trying to understand other existing components in relation to the tuturials, and how my own should be structured.

The tutorials demonstrate using models, but many of the existing components have Tables rather than models. When should I be using a model versus a table? The tutorials don't mention anything about tables, so I thought maybe it was the old way, but I don't know if the JTable functions like check-in/out, publish, etc. work without a table reference... can someone point me in the right direction there?

Also there seems to be a number of ways to define views. Some use &view=xx in the url, like the tutorial, others use a controller id in the url and let the controller choose the view based on the task (ie. admin.../com_banners)... is any one way 'right' or should I just use the one I like the best?

I also see a number of Helper files... how do these fit in?

I guess I'd just like to know the 'proper' way from the start(as much as I can), and I'm not sure if these things are needed and just not documented yet, or if they're old and I should ignore them.

User avatar
houby
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Tue Oct 30, 2007 5:36 pm
Location: CZ
Contact:

Re: MVC confusion

Post by houby » Wed Nov 07, 2007 8:58 am

Ahoy,

Being a newbie myself I keep searching this forum too, and found a real helper;

http://forum.joomla.org/index.php/topic,230018.0.html

Hope it helps you too!

User avatar
madsamurai
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Oct 02, 2007 6:13 pm

Re: MVC confusion

Post by madsamurai » Wed Nov 07, 2007 3:50 pm

Hi houby,
That was very helpful... not sure why it didn't show up in my search for MVC. It at least clarifies the relationships between the various files.

I think the most confusing part for me is understanding how those files reference each other. I'm beginning to understand that if things are named properly then the files reference each other without any help from me, and that you only need to specifically reference a specific controller,model, or view if it's outside of that naming scheme...

Also, just after I posted I went thru the MVC part 4 tutorial, which actually does demonstrate the use of tables along with a model, so I think I understand that now too. Guess I was just too glazed by the time I read that part the first few times thru it  :)

thanks!


Post Reply