To do development work in any framework, it is a good idea to first study the request flow. This basically answers the question ‘what happens between request send to server and request received from the server?’.
COPYRIGHT NOTICE
I have made the Flow Diagram available here for public use and/or modifications, as long as you cite me as an author. Although I have decided to share this, it took awhile to create this version, so I would appreciate getting some credit for my work.
Please refer to the Creative Commons Attribution-Noncommercial-share Alike license:
http://creativecommons.org/licenses/by-nc-sa/3.0/us/
You are free to share and make derivatives (i.e. corrections or updates), as long as you include a revision history, attribute the contributors as authors, you do not use it for commercial purposes, and you freely share the document.
You can download the request to response flow diagram as [download#14#nohits]
or as [download#15#nohits]
.
Here is what happens in case of Joomla 1.5…
When a request comes to Joomla website,
1) It loads framework files, but first of all it loads ‘defines.php’ and ‘framework.php’ files.
‘defines.php‘ as name suggest defines the some global constant for Joomla framework files and folders.
‘framework.php‘ first performs the installation check, and then initiates the process of importing all other files needed for Joomla framework to work.
2)Joomla ‘Site’ application is created, which basically means that $mainframe object is created.
Session is initialized by creating a new one if no session exists.
3) Application is initialized, it means that first website’s language file is loaded and then system plugin is loaded and onAfterInitialise system event is triggered to let other plugins know that application is ready for routing.
At this stage, Joomla core is up and running.
4)Routing of Request, i.e. request is now examined to determine which component should receive the request and verifies if the user has the privilege to do the requested action.
Afterwards ‘onAfterRoute‘ system event is triggered by Joomla to inform other plugins that system is now ready to dispatch the request to the component.
5)Application Dispatching, which basically means that requested component now get the change to handle the request. If the component does not exists then request is send to default component.
$document object is created and output from the component is buffered.
‘onAfterDispatch‘ event is triggered to let plugins know that system is now ready for rendering.
6) Application Rendering, is basically the process of putting the document buffers in the template placeholders.
If administrator has set the website to offline mode, then it shows the offline template otherwise rendered output is buffered in JResponse variable.
‘onAfterRender’ event is triggered to let plugins know that response is ready to send.
7)Response is sent, finally the buffered data in JResponse variable is sent back to the user.
This is the whole process followed by Joomla once it receives a request.
I know this is far from perfect, It would be great if some one who knows better can come up and help me improve this diagram.
PS: Join Joomla User Group India discussions at Google Group, http://groups.google.co.in/group/jugi or Joomladay.co.in
@punetech,
I think i will write one for Punetech.
Hi Amit,
This was a great post.
However, I was thinking that there are a large number of people who are unfamiliar with joomla, and introducing them would be a good idea. Wondering whether you could write a post on what is joomla, and what it is useful for, and why you should know about joomla if you are a techie. (For punetech if not for your own blog.)
Nice effort Amit!
I was searching for articles to understand Joomla Architecture but most of the things on net are far from Architecture discussion.
Your article is a good effort in that direction. I am impressed by your insight.
I would appreciate if you share your learning experiences and pointers to other study material and experiments, which leads to understanding the architecture better.
Thanks
Prateek
@prateek i simply opened the index.php files and followed the functions call’s one after other to get these details. if you want to get into deep, just start reading the joomla code. It is time consuming but worth the time spent.
Thanks for the wonderful flow diagrams Amit. They are very helpful and thanks for sharing those videos of your presentations too. i have one question. I have been trying to implement Facebook Connect on my Joomla website. I was able to register new users on my joomla based website using facebook connect but the prob which i am facing is regarding how to log them in. Can you help me with that please? What API call should i make or how should i create session.. Any leads will be very helpful…
I am not sure if you have checked this, but thier are some examples in ‘pluginsauthentication’ folder which allows you to choose different authentication mechanism. I am sure you will find what something their.
Step 4 in your description tells about login and authorization before loading joomla component. When an authorization is performed on itemId, However this itemId is of menuItem rather than the component itself and there are times when you call a component link without having it attached to a menuitem.Can u suggest how actually a login/authorization check can be performed over a componentId instead of itemId,So that a component loads only when login/authorization checks are performed
With regards to Facebook Connect feature.. all those authentication plugins are called when a user types in there user name and password and click on sign in. But in facebook connect the user detais are entered on facebook server not mine.. so i need to call some other mechanism to log user in. can you plzz suggest any..
Hi,
Very nice article.
Thanks For this.
Avinash
The request flow diagram is too good and easy to understand. Do you have similar request flow diagram for Version 1.7 or Joomla 2.5?