Documentation > Usage

Usage

After configuring Jake, all you need to do is to get the appropiate URL so you can host your CakePHP application inside Joomla. In the administrator panel, under the menu Components, select the option Jake, and click on the suboption Get Jake URL for CakePHP action. As a result, you should see a form similar to the following image:


Click image to enlarge

On the select box choose your CakePHP application (taken from the configuration file), and optionally set up a particular controller/action you want to run (if not the default). You’ll get the URL you need to use to run the specified application using Jake. Jake uses its own URL to integrate your CakePHP applications. It will automatically change URLs generated by CakePHP so that the application, once it is running on Jake, stays on Jake.

Let’s see how the CakePHP application Cheesecake Photoblog looks on Joomla 1.5:


Click image to enlarge

Jake Callables

Your CakePHP application can check whenever it is being run on Jake. This gives you the possibility to have a different layout for your application, or do whatever needs to be done differently. When a CakePHP application is running on Jake, a define named JAKE is created, which lets you easily check if you are running on Jake:

if (defined('JAKE')) {   

 // We are on Jake   

}

Let’s do an example. Our CakePHP application will be run through Jake, but also directly. Furthermore, we want to display the application using a different layout when it is being run on Jake. To do so, create the file app/app_controller.php in your CakePHP application main directory (if you already have one just add the code to your version), with the following contents:

class AppController extends Controller {
        function beforeRender() {
                if (defined('JAKE') && (!isset($this->layout) || $this->layout == 'default')) {
                        $this->layout = 'jake';
                }
        }
}

You can now create the layout file jake.ctp (CakePHP 1.2) or jake.thtml (CakePHP 1.1) on app/views/layouts, and customize it to suit your needs.

Jake also provides you of callbacks, which lets you take advantage of your bridge to Joomla. To use a callback you will first need to get an instance to Jake object, like so:

$jake =& Jake::getInstance();

You can then use the available callbacks Jake provides. So far these are the callbacks available (more will come):

Documentation


Navigate

 

Categories


Can't Miss