I am in the outlining phase of constructing a Routing system for a PHP Framework I am building.
I will need to use mod rewrite, for pretty urls. I got that part covered.
But say I want to make a page with the url like:
http://www.domain.com/news/10(News-id)/
and I want this dynamic variable ( This news id ) to have a name when rewriting.
What I want to achieve is;
Frameworks routes to news controller, and passes 10 as argument as:
$args = array ( ‘news_id’ => 10 )
You can use the
$_SERVERsuper-global to inspect the requested URI. In your example,$_SERVER['REQUEST_URI']will be set to something like:You can then get the requested news-id from that string.
Update
See the manual entry for
$_SERVER