I would like to write a router that is parsing an URL such as I am giving it the rules and after that I would like to have an array that is name based.
======
EDITED:
So I did rewrite the code a little bit the new code can be found here: http://pastebin.com/Ver601FF
The outcome can be seen here: http://img824.imageshack.us/i/phpprob.png/
What I now dont get is the way I could match the url values according to the regex within an array that has the indexes as the second route param has.
========================EDIT STOP================== At the end I would like to have an array:
$request['controller']
$request['action']
as the basic $request params, as I need them all the time- therefore this has to be my standard / default route.
So lets say the $pattern[2] is happening, when I finish with this horrible regex I would like to have this:
$request['controller']
$request['action'] = show
$request['id']
$request['name']
obviously everything has to be filled accordingly depending on the requested url...
It dont know if it is because of its late or not, but I cant figure out, how I have to match those things.
Do I need to split the url and after I was checking if it matches a route? and then work with the values that they go to each others.
Another problem where I dont know a solution to is the fact, that an url such as
"/information/show/some/other/stuff"
has to give me back something like
$request['controller'] = information
$request['action'] = show
$request['params'] = array(some, other, stuff)
I appreciate anykind of help and hope that somebody can help me out of this trouble :(
Thank you very much in advance.