I'm a developer and I am very confident with MVC patterns and have already developed a lot of web apps from scratch using PHP frameworks like symfony and yii. However, I'm a little bit confused about Joomla MVC and terminology. Even after googling a lot, reading Joomla book extension guides, and reading Joomla websites I'm still confused. What is confusing for me is the component MVC structure and how I have to set up "my way of thinking" about Joomla MVC, for doing things in the Joomla way.

In particular I am used to reasoning in terms of controller/action (like in symfony and yii framework)

So the final list of all my webapp url will be



Each controller's action will decide what view to render and what layout to use for showing the view. In particular in these frameworks, the definition of a layout is exactly the meaning of a layout. And the view is the "core part" of the page.

So I can have a view with a list of users and I can put this view inside a mobile layout or a desktop layout, or to build a view for mobile and put it only in the mobile layout and so on.

The final result of the directory structure in my webapp is something similar to the following:


and for me it is very clear to understand.

So finally my questions are:

  • what would be the directory structure in joomla?
  • what is the definition of view, layout and task in Joomla?

I need to clarify that I do not need an explanation about MVC works in general, but if I could achieve the same result as before, how do I have to organize my code and my work?

Suppose that I want to build a component with the following "url"



Thank you very much


Running ahead a little bit let me provide you with link to JooYii Library. This library makes a leap ahead brings some practices that would be at Joomla! 4 to current Joomla! 3.x branch along with other good things [common MVC, methods variables checks and bindings and other]. It's not reached first master yet, but only few inches around.

What concerns explanation of "Joomla specific MVC approach":

Components are more like independent applications. So what you need to know on "Terminology" and ways to achieve what you want to:

  • controller.php - Main controller;
  • controllers/anycontroller.php - Sub-controller;
  • models/anymodel.php - Your model, [!] not something like Yii model, just "sqls helper";
  • tables/anytable.php - Something like Yii model, but only like. It's not active record by representation of table`s row;
  • views/anyview/view.html.php - not view, but something like 'Extension of controller', included in controller`s display method;
  • views/anyview/tmpl/default.php - view`s layout, that's what you call 'view' at Yii, commonly;

Well that's it. All you need to know on terminology.

How to implement calls like controller/action.

  • set your component to the homepage to call it like controller/action or use /component/yourcomponent/controller/action
  • next step is to create router.php and set up parseRoute() to parse your route like $vars['task'] = $segments[0].$segments[1]

That's it, you're there. In super native joomla way you route to index.php?option=com_yourcomponent&task=controller.action instead.

| improve this answer | |
  • You're welcome. There are many people who run into this issue ) – Alexandr Jan 9 '17 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.