Welcome Guest, Not a member yet? Register   Sign In
Routing, regular expressions and category paths...
#1

[eluser]Maarten Troonbeeckx[/eluser]
You guys,

I'm trying to parse the following URLs:

Code:
http://my.shop.be/browse/electronics/hifi
http://my.shop.be/browse/electronics/hifi/00020/sony-bravia

The first one shows all products in subcategory hifi (parent category is electronics).
The second one show the product Sony Bravia with productID = 20.

My routes look like this (RegExhibit to the rescue Wink):

Code:
$route['browse/([a-zA-Z0_9\/]+)'] = 'browse/category/$1';
$route['browse/([a-zA-Z0_9\/]+)/([0-9]+)/[a-zA-Z0-9]+'] = 'browse/product/$2/$1';

My browse controller is setup like this:

Code:
function category($path);
function product($productID, $path)

Problem is that, instead of one parameter $path which equals 'electronics/hifi' in the both functions, it is passed as two parameters, i.e. 'electronics' and 'hifi'. This is because of this line of code in the Router class on line 289:

Code:
$this->_set_request(explode('/', $val));

Is this maybe a situation where _remap() comes into place?
Any ideas on how I can get 'electronics/hifi' passed into just one parameter $path in my controller functions?

Tnx in advance.

M.


Messages In This Thread
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 07:58 AM
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 08:03 AM
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 08:12 AM
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 08:12 AM
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 08:21 AM
Routing, regular expressions and category paths... - by El Forum - 07-26-2010, 08:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB