Jump to content


Photo

Name of file being viewed


  • Please log in to reply
1 reply to this topic

#1 haydndup

haydndup
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationJohannesburg, South Africa

Posted 27 May 2006 - 10:30 AM

How would i get php to find the name of the file being viewed?
ie -> i have a 'left.php' which is included in all pages on a site. But i want this content to change based on which file is viewing it ->index.php, about.php, contact.php etc. I want to use a set of if statements to determine the name of the file being viewed, and based on that, echo out content that is page specific...

I hope this makes sense..
TIA
[!--coloro:#660000--][span style="color:#660000"][!--/coloro--]The Gene Pool Could Use A Little Chlorine[!--colorc--][/span][!--/colorc--]

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 May 2006 - 12:18 PM

$_SERVER['PHP_SELF'] or $_SERVER['SCRIPT_NAME']
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users