What PHP command calls the URL to a string of text?

Discussion in 'PHP' started by jasonwilks, Jun 26, 2012.

  1. #1
    I have a problem here. With the FaceBook Comment system..

    I have a website where i have multiple pages (several hundred). Now when i add facebook comment box on all the pages with my template file and try to comment on one of my pages, that comment is coming on all the pages. I need the comment to be shown only on the page for which it is given.

    The command that puts the code on the page is like this:

    <div class="fb-comments" data-href="URL" data-num-posts="4" data-width="435"></div>

    The "URL" would be the URL of the actual current page of the site. Problem is, is that I need to find a way to automatically call the current URL of each page and fill that value in for that data-href= command.

    Anyone know of any PHP code to make this happen?
     
    jasonwilks, Jun 26, 2012 IP
  2. Lee Stevens

    Lee Stevens Active Member

    Messages:
    148
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    68
    #2
    You can try:

    
    <div class="fb-comments" data-href="<?php echo $_SERVER['PHP_SELF']; ?>" data-num-posts="4" data-width="435"></div>
    
    Code (markup):
     
    Lee Stevens, Jun 26, 2012 IP
  3. jasonwilks

    jasonwilks Well-Known Member

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    111
    #3
    nevermind I figured it out!
     
    jasonwilks, Jun 26, 2012 IP