Be a Supporter!

Retrieve page anchors via PHP?

  • 634 Views
  • 5 Replies
New Topic Respond to this Topic
Pilot-Doofy
Pilot-Doofy
  • Member since: Sep. 13, 2003
  • Offline.
Forum Stats
Member
Level 37
Musician
Retrieve page anchors via PHP? 2007-01-11 18:39:04 Reply

I was wondering, is it possible to retrieve page anchors via PHP? I've tried $_SERVER['REQUEST_URI'] and PHP_SELF and even the __FILE__ constant. Here's what I'm wanting to do.

Say someone accesses index.php#forums

I want to be able to see that they have #forums at the end of the URL. Is there anyway to retrieve anchors in this way? A javascript alternative or really anything would be alright as well.

eWhabs
eWhabs
  • Member since: May. 4, 2006
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to Retrieve page anchors via PHP? 2007-01-11 19:11:38 Reply

Maybe take the address and explode it with the # sign and check if the second var of the array is empty?


-Disregard females (fuck bitches)
-Acquire currency (get money)
-Ignite cannabis frequently (smoke sum with your homies)

BBS Signature
JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Retrieve page anchors via PHP? 2007-01-11 19:13:44 Reply

At 1/11/07 07:11 PM, eWhabs wrote: Maybe take the address and explode it with the # sign and check if the second var of the array is empty?

Yeah, just do that... what's the significance of using those other methods?

cherries
cherries
  • Member since: Jun. 7, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to Retrieve page anchors via PHP? 2007-01-11 19:23:01 Reply

Well if your doing what I think your doing you could just use htaccess:
Options +FollowSymLinks
RewriteEngine On

RewriteRule \#+(.*)$ http://www.website.com/index.php?id=forums?=$ 1 [L]

Are you doing that?

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to Retrieve page anchors via PHP? 2007-01-11 19:24:46 Reply

At 1/11/07 07:13 PM, JeremysFilms wrote:
At 1/11/07 07:11 PM, eWhabs wrote: Maybe take the address and explode it with the # sign and check if the second var of the array is empty?
Yeah, just do that... what's the significance of using those other methods?

But you can't get that current URL with PHP... PHP is server side, and anchors are tacked on on the client side.

The only thing that comes to mind for me is this: http://www.eggheadcafe.com/articles/20020107. asp


BBS Signature
Pilot-Doofy
Pilot-Doofy
  • Member since: Sep. 13, 2003
  • Offline.
Forum Stats
Member
Level 37
Musician
Response to Retrieve page anchors via PHP? 2007-01-11 21:37:12 Reply

lol duh!

I can just use window.location and pass it to a PHP page for all the manipulation. Easy enough eh? Thank God for my new Ajax book!