Saturday, February 8, 2014

[Joomla] Joomla Administrator Component Structure

An overview


What is a component in Joomla ?
According the definition in official site, a component is a kind of Joomla! Extension which are the main functional units of Joomla!; An easy analogy would be that Joomla! is the operating system and the components are desktop applications. They are usually displayed in the center of the main content area of a template (depending on the template).

Most components have two main parts: an administrator part and a site part. The site part is what is used to render pages when being called during normal site operation. The administrator part provides an interface to configure and manage different aspects of the component and is accessible through the Joomla! administrator application.

One of a specific component was shown in this picture:




Where to edit the components?
Path:
Your_joomla_root\cms\administrator

This is a list of the components for the administrator control panel in the image shown below,



and this article would use com_video as an example:




If the name of your component is named “video”, your directory name should be named com_video.
The files name In orange must same at the component name:
Files with yellow background are added for this project.
And the file with cancel line can be ignoring.

And let have an overviews of the MVC models in joomla:
1)      Model    (administrator part)
2)      Views    (site part)
3)      Controller (administrator part)

Models:

Models in joomla is in folder named models and tables.



Folder tree of these 2 folders:
1)      Models
1.1         Index.html (<- can ignore)
1.2         Video.php (<- store sql)
2)      Tables
2.1  Index.html (<- can ignore)
2.2  Video.php (<- store table 1 structure )
2.3  Videourl.php (<- store table 2 structure )



Video.php (1.2) in models is placing the sql.  For an example, the sql query was placed in the function insert_video_brand() and update_video_brand();



Video.php (2.2) in tables is placing the database table field. Detailed information please referenced from the image below:
Video.php is for a table named Tbl_video.



Videourl.php is for a table named Tbl_video_url.


======================

Views

Views of component you created in joomla is in folder named views. 




This is a list files tree of views
1)      Add
1.1         Tmpl
1.1.1   Default.php   (<- layout of add function)
1.1.2   Index.html    (<- can ignore)
1.2         Index.html       (<- can ignore)
1.3         View.html.php    (<- additional function for the add page)
2)      Edit
2.1    Tmp
2.1.1        Default.php  (<- layout of edit function)
2.1.2        Index.html   (<- can ignore)
2.2    Index.html       (<- can ignore)
2.3    View.html.php    (<- additional function for the edit page)
3)      list
3.1    Tmpl
2.3.1        Default.php  (<- layout of edit function)
3.1.1        Index.html   (<- can ignore)
3.2    Index.html       (<- can ignore)
3.3    View.html.php    (<- additional function for the list page)



1)     Add page
The file “add /tmpl /Default.php” (1.1.1) is a page contains the html code to control the list page layout. There is the layout:



File/view.html.php contains the additional function for add page,
For example, the display() method to control the display order and apply the filter to the list page display list.

2)     Edit page
The file “edit/tmpl /Default.php” (2.1.1) is a page contains the html code to control the list page layout. There is the layout:


File/view.html.php contains the additional function for list page,
For example, the display() method interactive with database.



3)     List page
The file “list/tmpl /Default.php” (3.1.1) is a page contains the html code to control the list page layout. There is the layout:


File/view.html.php contains the additional function for list page,
For example, the display() method to control the display order and apply the filter to the list page display list.

Controllers

The files with orange background is the controllers part.


File tree:
1)      Admin.video.php (-> call controller.php using require_once();)
2)      Controller.php  (-> load views and set define actions)

Content in admin.video.php is for get admin.video.php.


Content in is for loading views and set define actions:


No comments :

Post a Comment