Jump to content

Archived

This topic is now archived and is closed to further replies.

TEENFRONT

Get page name

Recommended Posts

Hey,

I use mod_rewrite to rewrite the URLs of my reviews section, so all my reviews ( music, movie, games ) all run from the same display_reviews.php file. Yet the address is teenfront.co.uk/movie-reviews/$name/$id.php

Is there a way to get that url? i wanna do some if statements so like if($type == "Movie") etc. Now i know i can query the database to get the type of review then display info based on that, but i was wondering if its possible to get that rewritten url from somewhere? it willcome in handy for other things aswell

Share this post


Link to post
Share on other sites
The original URL or the one re-written with mod_rewrite?

Anyway, you can use $_SERVER['PHP_SELF'] to get the current page name. Then you can split it with explode() by the /'s.

Share this post


Link to post
Share on other sites
the rewritten one.... i wanna grab the movie-reviews/$name/$id.php , but whenever i try to do that ( $_SERVER['PHP_SELF'] ), it grabs the display_reviews.php file.

Share this post


Link to post
Share on other sites
this may sound dumb, but if it's the variables you're after, they're sitting in the request superglobal for display_reviews.php, n'est-ce pas?  technically you could just rebuild the URL you want.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.