CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


Using CodeIgniter Applications

CoolBrew Framework can run CodeIgniter applications with a minimum of fuss. To illustrate the process, let's install a fictional application called "Trimtab".

When you download the Trimtab application file and unzip it, you get a directory structure like this:

trimtab/
   css/
   index.php
   js/
   system/
      application/
      cache/
      codeigniter/
      drivers/
      helpers/
      init/
      language/
      libraries/
      logs/
      plugins/
      scaffolding/

Copy the Files

Copy Trimtab's system/application/ folder into your CoolBrew modules folder. Since "application" isn't very descriptive, we'll rename it "trimtab".

You'll also want to copy the css/ and js/ folders into your website's document root so that the application can find them. Since the application wasn't designed to take advantage of CoolBrew's Collector library, these folders cannot be moved into the module folder like a normal CoolBrew module.

Lastly, you'll want to look carefully at the system/language, system/libraries, and system/plugins folders to make sure that there aren't any non-standard files being used outside the application folder. If there are, you will need to copy them to the equivalent folders in your CoolBrew installation.

Create an "index" File

In your website documents folder, create a new page where you want the application's screens to display. For our example, we create a page called trimtab.php. This is the equivalent of CodeIgniter's index.php file. In our case, the code in the file looks like this:

<?php
   require_once 'coolbrew.inc.php';
   get("trimtab");
?>

View Your Application

Now, using your web browser, go to the page you just created:

http://www.yoursite.com/trimtab.php

You should see a working copy of your application.

Troubleshooting

To allow CoolBrew to make multiple calls to the system, the CodeIgniter constant APPPATH had to be changed to a variable. Most of the time, this isn't important, but since we're dealing with an application designed to be run using CodeIgniter, we need to make sure these constants are converted.

The easiest way to find where this constant is used is to do a module-wide search using a text editor like BBEdit. Your search should look for APPPATH and replace it with APPPATH().

Limitations

Like any CoolBrew module, the application is available to any of the websites in your website group, but because the application was not designed to be used on multiple sites, it will access the same data regardless of which site it is displayed on.

Customizing the Look

Because CoolBrew looks for views first in the website's document root, then in the module's views folder, you should be able to create custom views for each of the websites that runs the application. If the application uses a different templating engine, however, this won't work. See the section on views in this guide for details.