SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Facebook sharer with location.hostname

    Hello,

    I'm creating a simple site that will be copied to several domains. The site contains a custom Facebook sharer link, and I want to avoid having to modify the link for each of the domains. It should take "current" web address somehow.

    As far as I can figure out, I'm trying to combine these two pieces of the puzzle:

    <A HREF="http://www.facebook.com/share.php?u=ADDRESS_TO_SHARE&title=Some Title" target="_blank"><img src="image.png" /></A>

    &

    location.hostname

    Or any other solution that doesn't involve third party plugins.


    Help would be very much appreciated!

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2011
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi dunementat,

    One more option is:

    <A HREF="http://www.facebook.com/share.php?u=<?php echo $_SERVER['SERVER_NAME'] ?>&title=Some Title" target="_blank"><img src="image.png" /></A>
    PHP Programming Itís more than just writing code

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank a lot!

    That's exactly what I was looking for (just didn't know it).


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
  •