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
controller1/action1
controller1/action2
controller1/action3
controller2/action1
controller2/action2
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:
controllers/
controller1
controller2
controller3
models/
modelForTableA
modelForTableB
views/
controller1/
viewForAction1
viewForAction2
layouts/
mobileLayout.php
desktopLayout.php
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"
userController/addUser
userController/editUser
userController/listUsers
userController/viewUserDetail
anotherController/addOperation
anotherController/editOperation
anotherController/myNonCrudOperation
Thank you very much