Welcome Guest, Not a member yet? Register   Sign In
User Guide: URI Class
#1

[eluser]macigniter[/eluser]
Unfortunately the user guide is missing crucial information on the usage of the URI Class. I think it would be great if the user guide could be updated asap.

Please also see the following thread
http://ellislab.com/forums/viewthread/78103/

Routed URIs

It should be clearly documented that routed URIs never contain a possible subfolder.

Code:
// in config/router.php
// $route['example'] = 'folder/controller';

// the user requests:
// http://www.domain.com/example

echo $this->uri->segment(1);   // = 'example'
echo $this->uri->rsegment(1);  // = 'controller'

// the user requests:
// http://www.domain.com/folder/controller/function/value

echo $this->uri->segment(1);   // = 'folder'
echo $this->uri->rsegment(1);  // = 'controller'

Also I think that it's necessary to include a way that possible subfolders ARE being included in the ruri functions. How about adding another parameter to the ruri functions like this:

Code:
function ruri_string($include_folder = FALSE) {
   $ruri = '/';
   if ($include_folder) $ruri .= $CI->router->fetch_directory();
   $ruri .= implode('/', $this->rsegment_array()).'/';
   return $ruri;
}

// example accessing:
// http://www.domain.com/folder/controller/

// normal behaviour
echo $this->uri->ruri_string();      // = /controller/index

// extended behaviour = return possible subfolder
echo $this->uri->ruri_string(true);  // = /folder/controller/index

Note: It is also good to know that the ruri functions always return the "index" method if no other method is specified in the URI.

Also, the following function includes the parameter "n" which is not really available:

Code:
$this->uri->ruri_string(n)
#2

[eluser]macigniter[/eluser]
It'd be great to get some official feedback from someone at Ellislab on this one.




Theme © iAndrew 2016 - Forum software by © MyBB