CoolBrew User Guide Version 1.3
Based on CodeIgniter Version 1.5.4


URI Module

This module gives you access to the URI class from your website documents. The URI Class provides functions that help you retrieve information from your URI strings. If you use URI routing, you can also retrieve information about the re-routed segments.

For more information about the methods accessed by these tags, please see the URI Class section of the CodeIgniter User Guide.

<?php get('core.uri.segment', n, $no_result); ?>

Permits you to retrieve a specific segment, where n is the segment number you wish to retrieve. By default the function returns FALSE (boolean) if the segment does not exist. $no_result permits you to set your own default value if the segment is missing. For example, this would tell the function to return the number zero in the event of failure: <?php $product_id = get('core.uri.segment', 3, 0); ?>

<?php get('core.uri.rsegment', n, $no_result); ?>

This tag is identical to the previous one, except that it lets you retrieve a specific segment from your re-routed URI.

<?php get('core.uri.slash_segment', n, 'where'); ?>

This tag is almost identical to get(core.uri.segment), except it adds a trailing and/or leading slash based on the second parameter. Options for 'where' are 'trailing', 'leading', and 'both'.

<?php get('core.uri.slash_segment', 3, 'both');

// Produces: /segment/

<?php get('core.uri.slash_rsegment', n, 'where'); ?>

This tag is identical to the previous one, except that it lets you add slashes a specific segment from your re-routed URI.

<?php get('core.uri.uri_to_assoc', n, $default); ?>

Turns URI segments into an associative array of key/value pairs. See the URI Class section of the CodeIgniter User Guide for details.

<?php get('core.uri.ruri_to_assoc', n, $default); ?>

This tag is identical to the previous one, except that it creates an associative array using your re-routed URI.

<?php get('core.uri.assoc_to_uri', $array); ?>

Takes an associative array as input and generates a URI string from it. The array keys will be included in the string. Example:

$array = array('product' => 'shoes', 'size' => 'large', 'color' => 'red');

$str = get('core.uri.assoc_to_uri', $array);

// Produces: product/shoes/size/large/color/red

<?php get('core.uri.uri_string'); ?>

Returns a string with the complete URI. See the URI Class section of the CodeIgniter User Guide for details.

<?php get('core.uri.ruri_string'); ?>

This tag is identical to the previous one, except that it returns your re-routed URI

<?php get('core.uri.total_segments'); ?>

Returns the total number of segments.

<?php get('core.uri.total_rsegments'); ?>

his tag is identical to the previous one, except that it returns the total number of segments in your re-routed URI

<?php get('core.uri.segment_array'); ?>

Returns an array containing the URI segments. See the URI Class section of the CodeIgniter User Guide for details.

<?php get('core.uri.rsegment_array'); ?>

This tag is identical to the previous one, except that it returns the array of segments in your re-routed URI