CI_URI::total_segments()

total_segments() Returns: Count of URI segments Return type: int Returns the total number of segments.

CI_URI::slash_rsegment()

slash_rsegment($n[, $where = 'trailing']) Parameters: $n (int) – Segment index number $where (string) – Where to add the slash (‘trailing’ or ‘leading’) Returns: Routed segment value, prepended/suffixed with a forward slash, or a slash if not found Return type: string This method is identical to slash_segment(), except that it lets you add slashes a specific segment from your re-routed URI in the event you are using CodeIgniter’s URI Routing feature.

CI_URI::uri_string()

uri_string() Returns: URI string Return type: string Returns a string with the complete URI. For example, if this is your full URL: http://example.com/index.php/news/local/345 The method would return this: news/local/345

CI_URI::total_rsegments()

total_rsegments() Returns: Count of routed URI segments Return type: int This method is identical to total_segments(), except that it returns the total number of segments in your re-routed URI in the event you are using CodeIgniter’s URI Routing feature.

CI_URI::uri_to_assoc()

uri_to_assoc([$n = 3[, $default = array()]]) Parameters: $n (int) – Segment index number $default (array) – Default values Returns: Associative URI segments array Return type: array This method lets you turn URI segments into an associative array of key/value pairs. Consider this URI: index.php/user/search/name/joe/location/UK/gender/male Using this method you can turn the URI into an associative array with this prototype: [array] ( 'name' => 'joe' 'loc

CI_URI::slash_segment()

slash_segment($n[, $where = 'trailing']) Parameters: $n (int) – Segment index number $where (string) – Where to add the slash (‘trailing’ or ‘leading’) Returns: Segment value, prepended/suffixed with a forward slash, or a slash if not found Return type: string This method is almost identical to segment(), except it adds a trailing and/or leading slash based on the second parameter. If the parameter is not used, a trailing slash added. Examples: $this->uri->slash_segment(3); $

CI_URI::rsegment()

rsegment($n[, $no_result = NULL]) Parameters: $n (int) – Segment index number $no_result (mixed) – What to return if the searched segment is not found Returns: Routed segment value or $no_result value if not found Return type: mixed This method is identical to segment(), except that it lets you retrieve a specific segment from your re-routed URI in the event you are using CodeIgniter’s URI Routing feature.

CI_URI::ruri_string()

ruri_string() Returns: Routed URI string Return type: string This method is identical to uri_string(), except that it returns the re-routed URI in the event you are using CodeIgniter’s URI Routing feature.

CI_URI::rsegment_array()

rsegment_array() Returns: Routed URI segments array Return type: array This method is identical to segment_array(), except that it returns the array of segments in your re-routed URI in the event you are using CodeIgniter’s URI Routing feature.

CI_URI::assoc_to_uri()

assoc_to_uri($array) Parameters: $array (array) – Input array of key/value pairs Returns: URI string Return type: string 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 = $this->uri->assoc_to_uri($array); // Produces: product/shoes/size/large/color/red