Site Structure

Bonfire’s site is structured with three goals in mind:

Hopefully, this page will give you an idea of the reasoning and purpose behind the structure.

Folder Structure

application/
    archives/
    cache/
    config/
    controllers/
    core/
    db/
        backups/
        migrations/
    docs/
    errors/
    helpers/
    hooks/
    language/
    libraries/
    logs/
    models/
    modules/
    third_party/
        MX/
        Sparks_Loader.php
    views/
bonfire/
    codeigniter/
    controllers/
    core/
    docs/
    helpers/
    libraries/
    migrations/
    modules/
public/
    assets/
        cache/
        css/
        images/
        js/
    index.php
    themes/
        admin/
        default/
        docs/
tests/
    _support/
    application/
    bonfire/
    simpletest/
tools/
    lib/
        spark/
            spark_types/
    spark

Application

The application folder is where you will do most of your work. This contains all of your controllers, libraries, helpers, models, and any modules you might use.

As much as possible, Bonfire stays away from this folder. However, there are a few files that we cannot move out of the application folder due to restrictions in either CodeIgniter or the HMVC solution that we use. Most of these files are located in the application/third_party folder or the application/core folder.

The application/third_party folder contains Sparks_Loader.php for sparks support and the bulk of the HMVC solution, located in the application/third_party/MX folder.

While it is best to stay away from the *_Controller.php files in the application/core folder (you can create your own controllers in this folder to extend them), the MY_Model.php file is intended to be modified as you see fit.

Most of the folders within the application folder are the standard CodeIgniter folders you would expect. There are a few new ones that Bonfire adds.

DB folder

The db folder stores two things:

Modules folder

This folder is where you should create all of your own modules. It is also where Bonfire creates module-related files for you. Each module should have a folder with its own unique name here.

It is also possible to override portions of Bonfire’s core modules by adding files here, following the folder/file names in the Bonfire module you wish to override.

Bonfire

The bonfire folder holds Bonfire, itself, as well as the codeigniter system files.

Public

This folder is where you should point your domain name to. It holds the files and folders that should be accessible from the web.

Reverting To Traditional Structure

In some situations, you may prefer a more traditional folder structure that has all of the files and folders located in the web root. This might be due to restrictions on shared hosting, or becuase you prefer easier installation for your customers. This can be easily done by moving the files and folders from the public folder into the same folder as the others, overwriting the root index.php with the public/index.php file. This would leave a folder structure like:

application/
assets/
bonfire/
index.php
tests/
themes/

After you’ve moved the files, you need to edit the main index.php file to let CodeIgniter know where to find the application and system folders.

$path = '.'

Changing this variable will set all of the other paths.