Jump to content


Photo

Get page name


  • Please log in to reply
3 replies to this topic

#1 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 16 July 2006 - 02:08 PM

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
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#2 Gast

Gast
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 16 July 2006 - 08:51 PM

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.
OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Tutorials:
Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#3 TEENFRONT

TEENFRONT
  • Members
  • PipPipPip
  • Advanced Member
  • 338 posts

Posted 17 July 2006 - 11:42 PM

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.
Teenfront.co.uk : Free Teen Chat -  FunkySmileys.co.uk : MSN Smileys -  ArcadeMonkey.co.uk : Free Flash Games
8Baller.co.uk : Free Multiplayer Pool [url=http://8Baller.co.uk]

#4 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 18 July 2006 - 03:14 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users