- Details
- Written by: Stanko Milosev
- Category: MVC
- Hits: 5516
It seems that phpeveryday site does not working anymore, but I found on Joomla! site also a tutorial about MVC:
http://forum.joomla.org/viewtopic.php?f=231&t=136576
http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,components:hello_world_mvc1/
Also, I create two components, one where is MVC applied, and second without MVC.
Here is with MVC, and here is without.
If in our XML manifest file, give name of the component hello, for example, in root folder of component, com_hello, for example, must be hello.php - that's about creating components.
In MVC component which I puted for download, I also explained some of API's of Joomla! framework.
- Details
- Written by: Stanko Milosev
- Category: MVC
- Hits: 5245
Here I will write about creating components using Model - View - Controler design pattern in Joomla! framework.
Firs of all, what is MVC?
MVC design pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. Taken from Wikipedia.
Second, how we built MVC in Joomla! framework?
I don't know :) I am still learning it, so here are some informations which I found.
I was using phpeveryday web site as a base.
If we create hello component, as it is described in phpeveryday web site, we will need following files, and folders:
com_hello - root dir
com_hellocontroller.php - here we are defining our model and view... Still I am not 100% sure what is used for, my guess is that here we will define functions and variables which we will use for view and model.
com_hellohello.php - our base - also not quite sure about it, I think it does redirect and execute a function which will be defined in task variable
com_helloviewsallview.html.php - here we are defining variables for our view
com_helloviewsall mpldefault.php - here is our view
com_hellomodelsall.php - model - here we are accessing to database, for example, and gets data as an array
You can download component, which I will use as a test bed, created by using phpeveryday, from here.
For now, this is all...