Welcome Guest, Not a member yet? Register   Sign In
Remap or URI Routing or What?
#2

[eluser]mddd[/eluser]
So if I get it correctly:

/communities/overview will load the "overview" method
/communities/some_community will probably load a "show community" method
/communities/some_community/join will load a "join" method

You CAN use routes for this, but you'll have to specify all "real" methods:
Code:
// check the real methods to let them through
$route['communities/overview(.*)'] = 'communities/overview$1';
$route['communities/other_method(.*)'] = 'communities/other_method$1';

// check if a community + method was called. if so, rewrite it to load that method
// this does: communities/my-community/join/other/arguments -> communities/join/my-community/other/arguments
$route['communities/([^/]+)/([^/]+)(.*)'] = 'communities/$2/$1$3';
// a safer version of this would be to again specify all methods:
$route['communities/([^/]+)/some_method(.*)'] = 'communities/some_method/$1$2';

// finally, if a 'method' was called without anything after it, call the 'show community' method
$route['communities/([^/]+)'] = 'communities/show/$1';


Messages In This Thread
Remap or URI Routing or What? - by El Forum - 08-05-2010, 01:59 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 02:12 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 02:21 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 02:28 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 02:38 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 02:50 AM
Remap or URI Routing or What? - by El Forum - 08-05-2010, 03:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB