share products on Facebook

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yousef Altaf
    New Member
    • Jun 2011
    • 22

    share products on Facebook

    I am trying to share my products image on Facebook but somethings gos wrong with the URL of the products I used this code on the header of the page

    Code:
    (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
    and than I used this for my share Icon

    Code:
    <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo "https%3A%2F%2F$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>" target="_blank"><img src="images/facebook.png" class="f_right m_left_right_5px" width="30" height="30"  alt="facebook"/></a>
    I used this PHP code to get the link of the products

    Code:
    https%3A%2F%2F$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]
    the link should appear something like this

    Code:
    https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fnadim.org/new2/index.php?pid=v4&prodid=136&cat=1
    but in the share box it appear like that

    Code:
    https://nadim.org/new2/index.php?pid=v4
    what did I made wrong. thanks
  • Yousef Altaf
    New Member
    • Jun 2011
    • 22

    #2
    OK I should answer this now so anybody has the same problem should take care about this
    in my URL that I am trying to get
    it should look like this
    Code:
    https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fnadim.org/new2/index.php?pid=v4&prodid=136&cat=1
    the all problem was this
    Code:
    &
    when I replaced with this
    Code:
    &amp;
    everything worked fine for me

    thanks and regards for all.
    Yousef

    Comment

    Working...