JOOMLA! Component Building
All Joomla! extensions must be packaged as a .zip installation file .According to the most common file arrangement, the package should contain at least the following two folders as a basic structure:
- site
- admin
If you set up your XML manifest file according to standard practice, the contents of site will be installed to /components/com_{componentname}, whereas the contents of admin will be installed to /administrator/components/com_{componentname}.
The /site folder
This folder keeps the files for the frontend part of the component.
/site/{componentname}.php- This is the component’s main file and entry point for the frontend part.
/site/controller.php- This file holds the default frontend controller, which is a class called
{ComponentName}Controller. This class must extend the base classJController.
/site/views- This folder holds the different views for the component.
-
/site/views/{viewname}- This folder holds the files for the view {ViewName}.
-
-
/site/views/{viewname}/view.html.php- This file is the entry point for the view {ViewName}. It should declare the class
{ComponentName}View{ViewName}. This class must extend the base classJView. The.htmlsection of the filename is related to the format the view will be loaded in. For example, if theformatURL parameter is set toformat=feed, the fileview.feed.phpwill be loaded.
-
-
-
/site/views/{viewname}/tmpl- This folder holds the template files for the view {ViewName}.
-
-
-
-
/site/views/{viewname}/tmpl/default.php- This is the default template for the view {ViewName}. In this PHP file, the
$thiskeyword refers to the view class that the template belongs to.
-
-
/site/models- This folder holds additional models, if needed by the application.
-
/site/models/{modelname}.php- This file holds the model class
{ComponentName}Model{ModelName}. This class must extend the base classJModel. Note that the view named {ViewName} will by default load a model called {ViewName} if it exists. Most models are named after the view they are intended to be used with, but this is not a requirement. See Using multiple models in an MVC component for more information.
/site/controllers- This folder holds additional controllers, if needed by the application.
-
/site/controllers/{controllername}.php- This file holds the controller class
{ComponentName}Controller{ControllerName}. This class must extend the base classJController.
The /admin folder
The file structure is exactly the same as in the /site folder.
