CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


CoolBrew URLs

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

No Class/Method Needed

URLs in CoolBrew differ from CodeIgniter URLs in that they may not have to include information about the class and method being requested since in most cases that information is part of the tag and may be different for each tag in the file.

Let's say that you have a CoolBrew controller called products designed to display product information on your website via a method called detail. In CodeIgniter, you would have to supply the controller and method as part of the URI, followed by the product ID. It might look like this:

http://www.yourdomain.com/index.php/products/detail/247/

With CoolBrew, you place a tag into your product detail page:

<?php get('products.detail'); ?>

Since the controller and method are specified in the tag, you need only to supply the product ID in the URL. Your URL might look like this:

http://www.yourdomain.com/index.php/247/

Granted, you probably won't have this tag on your home page, so your URL would probably look something like the URL below. It's no shorter than the CodeIgniter URL, but you get to use your existing static website pages:

http://www.yourdomain.com/products/detail.php/247/

CodeIgniter Emulation

If you are using a tag to emulate CodeIgniter, then you will need to set up your URLs as you would for a CodeIgniter application. See the Emulating CodeIgniter section in this guide for more information.

Supplying Data to Multiple Tags

If you want to supply variables to more than one tag, that can get a bit tricky, but you might find that it's unnecessary. Some of the things you might have passed via the URL in CodeIgniter may be able to be hard-coded into your PHP file since it is a specific file and not a generic index.php file. For example, where you might have had to supply a page ID to set a menu in CodeIgniter, that info can be supplied in the file, or can be based on the filename in CoolBrew.

Alternatively, you can set up your URIs as key/value pairs so you can specify which variable goes with which value, and therefore assign them to the correct tags. See the URI Class section of the CodeIgniter User Guide for more details.