Announcement

Collapse
No announcement yet.

#top

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #top

    I have a link at the bottom of my forums that brings the scroll bar up to the top of the page:

    <a href="$PHP_SELF?$QUERY_STRING#top"><img src="{imagesfolder}/toparrow.gif" border="0"></a>

    This doesn't work correctly when there isn't a query string in the URL or there isn't a file specified (index being loaded)... it just ends up loading the page again rather than "instantly scrolling" because the href isn't exactly the same as the address in the browser.

    Question:
    Is there a PHP variable that returns the exact URL of the current page without having to piece it together like I'm doing now?

  • #2
    Just use <a href="#top">, it should work. But for your question, there's $_SERVER[REQUEST_URI] which is exactly the address of the page without the server.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Chen is obviously correct, you can use anchor names without giving the URI, and also about $_SERVER['REQUEST_URI']... nothing to add, just wanted to confirm

      Comment


      • #4
        Thank you sir.
        Chen Avinadav
        Better to remain silent and be thought a fool than to speak out and remove all doubt.

        גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

        Comment


        • #5
          Originally posted by Chen
          Just use <a href="#top">, it should work.
          duh

          I hate it when I overcomplicate stuff. I need to step back and think easy, not hard.

          Comment

          Related Topics

          Collapse

          Working...
          X