Welcome Guest, Not a member yet? Register   Sign In
"Silently" redirecting to a different controller?
#5

[eluser]ech0[/eluser]
How ugly, in terms of speed, is this kind of solution?

<b>routes.php</b>:
Code:
/*
| -------------------------------------------------------------------------
| DYNAMIC ROUTES
| -------------------------------------------------------------------------
*/
$fh = fopen(realpath('routes.csv'), 'r');
while (($data = fgetcsv($fh, 100)) !== FALSE)
// $data[0] = fake URI
// $data[1] = module name
// $data[2] = page id
{    
    // route to controller/index
    $route[$data[0]] = 'modules/'.$data[1].'/index/'.$data[2];
    // route to controller/method/params
    $route[$data[0].'/(:any)/(:any)'] = 'modules/'.$data[1].'/$1/'.$data[2].'/$2';
}
fclose($fh);


Messages In This Thread
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 06:00 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 06:02 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 06:07 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 07:23 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 07:37 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 08:38 AM
"Silently" redirecting to a different controller? - by El Forum - 06-21-2009, 08:42 AM
"Silently" redirecting to a different controller? - by El Forum - 06-22-2009, 08:29 AM
"Silently" redirecting to a different controller? - by El Forum - 06-22-2009, 09:59 AM
"Silently" redirecting to a different controller? - by El Forum - 06-22-2009, 04:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB