Search code examples
joomla2.5joomla-extensions

What is mean 's' in end of names of controllers and views of Joomla 2.5


I studding to developing component for Joomla 2.5 by this totorial:

http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Developing_a_Basic_Component

Now, there is several cases such as:

HelloWorldControllerHelloWorld
HelloWorldControllerHelloWorlds

in files:

controllers/helloworld.php
controllers/helloworlds.php

or:

HelloWorldControllerHelloWorld
HelloWorldControllerHelloWorlds

in files:

helloworld/view.html.php
helloworlds/view.html.php

My question is:
What the difference between those cases when there is 's' in end and cases when you don't have 's' in the end?

And second thing.
This totorial is very good, but it is good as totorial. Is some one have some site whith deep documentation of all these concepts (exept Joomla API)?
Thank you for ahead.


Solution

  • The "s" at the end of the class declaration denotes the plural. I personally think that this example with HelloWorlds (although correct) is rather confusing for newcomers.

    • HelloWorld (controller, model and view) (singular) will usually lead to a view where you view or edit a single record.
    • HelloWorlds will lead to a view where you can view multiple records and perform some operations on them.

    On the other hand, I don't think there are a lot of good tutorials, expect that you can look at components included in Joomla (as com_contacts, com_banners, etc).

    Also check the documentation regarding Joomla! Naming Conventions

    Also I would recommend the book Joomla! Programming from Mark Dexter and Louis Landry. They explain in more details how everything fits together.