The Joomla 3.x File System Layout
When Joomla is first unzipped to the root folder of the web server for installation quite a number of files and folders are created. Understanding what these files and folders are will aid you in the long run when you start to develop extensions for the Joomla CMS.
The first thing to understand about Joomla, is that it consists of three applications. There is the “site” application, which is what your users see. For example, when you type http://www.joom.dev in your browser, Joomla is serving the “site” application. The “site” applications files and folders reside in the root of your web folder. Next there is the “administrator” application. This is what Joomla runs when you are in the backend, creating content, menus, categories, etc when your browser is pointed to http://www.joom.dev/administrator. The “administrator” application files and folders are all located under the administrator folder within in your web sites root web folder. Lastly, there is the “Installation” application. This application runs the very first time you access your Joomla site. It's job is to set up the environment for your Joomla install, including things like the site name, description, the database server and credentials, installing sample data and other things. Unlike the site and administrator applications, the install application needs to be deleted or disabled by some other means after is completes its job before Joomla will allow you to run the site and administrator applications.
The image to the left shows the files and folders created when you first extract the Joomla archive to your computer. Understanding what these files and folders are, is key to getting a grip on how the Joomla CMS and the extensions for it work. As I progress through the series, this will be talked about in more depth but for now it would be a good idea to cover the basics. Below is a short description of the folder or file listed in the image to the left.
administrator: This folder and all the folders and files it contains run the administrator application. We will come back to this in a little bit.
bin: The bin folder holds the keychain class and is used by Joomla when there is a need to load or store data to an encrypted data source.
cache: The cache folder holds cached modules, pages and views that do not change frequently. By caching a module, page or view it saves Joomla some processing time because it does not have to generate these again and as a result will serve the page a little faster.
cli: The cli folder holds scripts that would interact with Joomla or its database but would not be run from the web browser. For example, if we had a turn based game component, a file in the cli folder would be run with cron periodically to update the game turns. This is where you would want to store any scripts that need to modify the data of one of your extensions outside the normal Joomla web interface.
components: The components folder is home to all the site application's components. In a default install of Joomla, this is where the content, contacts and other components are stored. There will be much more to learn about the component hierarchy when we start writing components for Joomla.
images: The images folder is where assets for your web pages and extensions are stored. These would be images and assets the user has uploaded to the web server, or possibly assets that belong to an extension you have written but are intended to be changed or modified. I say this, because there is another place that is used in addition to store assets for your extension.
includes: The includes folder contains bootstrap code that starts Joomla. The application's index.php files uses the files in this folder to create the constants needed to find things like libraries, plugins and templates. Included in this folder is the bootstrap for the framework. The framework will load the necessary files to start Joomla and then check for and import the configuration, etc.
installation: This folder and the contents under it hold the installation application. The installation application is responsible for setting up the environment and other details about your Joomla install. The installation application is typically ran one time and is removed from the website after it has run.
language: Joomla is designed to be a multi-lingual CMS. It is in this folder that the site application stores the language files for the Joomla CMS and any components or modules that run. A folder exists below this folder for each language you want to use in Joomla. Unless you have installed additional language packs there should be one folder under the language folder with the name of the language you selected at the time you install Joomla. As you will learn later when we start to develop extensions, there are other locations that language files can be stored.
layouts: Joomla allows you to override layouts. Sometimes you want the same layout for different extensions. Joomla allows this by allowing you to group layouts together. Joomla groups it common layouts together in this folder. You can use these in your own extensions or you can even override these layouts. More on this topic when we get into extension development.
libraries: This folder contains all the library classes and code that Joomla uses to run. You can also install you own libraries here making them available to other extensions.
logs: This folder contains any logs that Joomla may write. Additionally, you can use this folder when logging information with your component using JLog.
media: This folder holds assets related to extensions and the Joomla system. For example, in this folder you would store images, css, javascript or other assets that your extension would use but would never be modified under normal circumstances. It differs from the images folder in that respect. The images folder could hold assets for your extension, but these are likely to be changed over time. More will be discussed on this folder when we start developing extensions.
modules: This folder hold the module extensions for the site application or frontend. Each module installed in Joomla will reside in a folder under this folder. More will be discussed about this folder when we start developing modules for Joomla.
Plugins: This folder hold the plugin extensions for the site application or frontend. Each plugin installed in Joomla will reside in a folder under this folder. More will be discussed about this folder when we start developing plugins for Joomla.
templates: Templates are another type of extension that can be written for Joomla. Templates define the overall look and feel for the website. Each template installed in Joomla will reside in a folder under the templates folder. We will cover more about this when we discuss templates and layout overrides.
tmp: The tmp folder hold files and data that are in temporary use. For example, when you upload a component or other extension to Joomla, that file is usually a zipped archive. Joomla will extract the archive in the tmp folder to do the installation process.
htaccess.txt: This is a sample htaccess file that you can use if you are using a server that runs Apache web server. This file is used to control how Apache handles some things. For example, if you were to use Joomla friendly URL encoding you would use this file to control the rewriting of the URLs.
index.php: This is the file that loads when Joomla is called on the Frontend. It is responsible for creating and running the site application that was discussed above.
LICENSE.txt: This file holds the text of the GPL License that Joomla is released under. If you have never read the GPL License, you should take the time to read it at least once.
README.txt: This is Joomla's main readme file. It explains what Joomla is, how to get updates, how to get involved and some other stuff. It is a small file and you should take the time to read it through.
robots.txt.dist: This file is a sample robots.txt file to use on your site to prevent search engines from indexing your site folders. Robots will still be allowed to index your site content, but there is no reason for them to index the files and folders that make up your website. If allowed to do so, then there is a chance that a hacker would be given sensitive information that may assist them in hacking you. The comment in the top of the file explains how it is used.
web.config.txt: This file is like the htaccess file discussed above, but is used for MS IIS.
That concludes the list of the files and folders that are included on the site application install. These folders and files are used in the context of the sites Frontend with exception of the administrator and installation folders. Since this series of tutorials does not cover the installation application no detail discussion of its folders and files will be mentioned. However, because extensions that are written for Joomla cover both the site and administrator applications, a discussion on the files and folders in the administrator folder will follow.
The image to the left shows the files and folders that are created under the administrator folder when Joomla was extracted. Below is a list of them and what they mean.
cache: Just like the Frontend or site application, this is where Joomla will store cached content to save processing time making the site a little faster.
components: This folder holds all the components that are installed on the Backend or administrator application. Each installed component will have its own folder located under this folder.
help: This folder holds the files for the web locations of the help system built into Joomla.
includes: Like the Frontend, the includes folder has files and defines that help start the administrator application.
language: This is where the laguage file are stored for the Joomla CMS as well and extensions. When we start to develop extensions we will discover that there are other places that language files can be stored.
manifests: The manifest folder holds the xml manifest files for files, libraries and packages installed for the core Joomla CMS. Manifest files as you will learn hold all the information Joomla requires to install, upgrade and remove software from the Joomla framework. We will be discussing manifest files in detail when we start developing extensions for Joomla.
modules: Just like the Frontend, the Backend (administator application) can have modules installed. Modules for the Backend are stored under this folder.
templates: Just as the Frontend can have template defining the look and feel the end user gets, so does the Backend. Templates are stored in folders under this one for the Backend.
index.php: When the Backend application is started by going to http://www.joom.dev/administrator this is the file that gets launched. It is responsible for setting up the application and launching it.
That pretty much sums up the files and folders that are created when you install Joomla. I know that I didn't go into great detail about some of them, but we will learn their use and naming conventions as we go through the process of learning to develop extensions for Joomla. Thank you for your participation.
ALL DONE!!!