Results 1 to 6 of 6

Thread: location-esque function?

  1. #1
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default location-esque function?

    Is there a function in php that works like the document.location object in javascript? And if not, is there a way to merge php with javascript? I want to write a function that returns a different value for a variable depending on the document.location, but I have no idea how to do this. Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    $loc = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, I actually wouldn't have thought to do that . . . but I'm looking for something that will find the location of any frame in the window, including the topmost, not just the one in which the php script resides. I want to compare the url of the "current" frame against the url of the "top" frame.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Then no, I'm afraid not. You'll have to use Javascript to get the values, then possibly pass them to PHP via an XMLHttpRequest.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    How would i do that?

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Read http://www.w3schools.com/ajax/default.asp for a basic introduction.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •