Welcome Guest, Not a member yet? Register   Sign In
URI Class subfolder and Routing
#1

[eluser]OliverHR[/eluser]
I'm a little confused, why URI library never return subfolders name when using a route.

Let me show my problem, I definded this route:

Code:
$route['product/(:num)'] = 'admin/products/detail/$1';

Where:

"admin" is a subfolder in the controllers folder.
"products" is a controller
"detail" is a function who expects a numeric parameter

I must say that everything works fine, but if i try to use the next code:

Code:
function detail($id = 0)
{
  echo '<pre>';
    print_r($this->uri->segment_array());
    print_r($this->uri->rsegment_array());
  echo '</pre>';
}


Using the url "http://localhost/product/1" I get this:

Quote:Array
(
[1] => product
[2] => 1
)

Array
(
[1] => products
[2] => detail
[3] => 1
)

And The subfolder?...


But, if I use the full url "http://localhost/admin/products/detail/1" I get:

Quote:Array
(
[1] => admin
[2] => products
[3] => detail
[4] => 1
)

Array
(
[1] => products
[2] => detail
[3] => 1
)

Thank's in advance for any help.


Messages In This Thread
URI Class subfolder and Routing - by El Forum - 08-08-2011, 03:23 PM
URI Class subfolder and Routing - by El Forum - 08-08-2011, 03:26 PM
URI Class subfolder and Routing - by El Forum - 08-08-2011, 03:49 PM
URI Class subfolder and Routing - by El Forum - 08-08-2011, 04:11 PM
URI Class subfolder and Routing - by El Forum - 08-08-2011, 04:54 PM
URI Class subfolder and Routing - by El Forum - 08-13-2011, 04:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB