CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


Controllers

Note: This page is an extension of the CodeIgniter User Guide page of the same name. Please read the CodeIgniter Controllers page in addition to this page for complete information about this feature.

The Hello World! Example as a CoolBrew Tag

Let's rework the Hello World! example from the CodeIgniter User Guide to create a simple CoolBrew module and controller. Start by creating a new module folder by duplicating the _default folder inside the system/modules/ folder and renaming it hello.

Now, using your text editor, create a file called hello.php, and put the following code in it:

Then save the file to your system/modules/hello/controllers/ folder.

Now, using your text editor, create another file called hello-test.php, and put the following code in it:

Now save that file to your website's document root folder and visit your site using a URL similar to this:

http://www.your-site.com/hello-test.php

If you did it right, you should see Hello World!.

More Tags

In the above example the function name is world(). You can add more tags to your controller by creating more functions. Add a new function to your controller:

Now, add a second tag to your hello-test.php file, save it and upload it to your website's document root folder.

Load the same URL as before to see the additional letterman tag display:

http://www.your-site.com/hello-test.php