0

hello,

i have to share products in facebook from my site.
i used ths code for share.

<a href="http://www.facebook.com/sharer.php?u=http://<?=$_SERVER['HTTP_HOST']?>/blockbuys/details.php?route=product/product&product_id=<?=$fetpro['auto_id']?>&amp;t=<?=$fetpro['productname']?>"><img src="images/facebook.jpg" /></a>

but product image is not displaying in facebbook.
how to do this task?

thnks.

2
Contributors
4
Replies
7
Views
7 Years
Discussion Span
Last Post by muralikalpana
0

Inside your php opening and closing tags you need to echo the $_SERVER['HTTP_HOST'] or whatever, you can't just write it the way that you have. Also, you shouldn't use short tags for opening and closing php, use <?php ?> instead.

0

Inside your php opening and closing tags you need to echo the $_SERVER['HTTP_HOST'] or whatever, you can't just write it the way that you have. Also, you shouldn't use short tags for opening and closing php, use <?php ?> instead.

i just wrote what you said..

<a href="http://www.facebook.com/sharer.php?u=http://<?php echo $_SERVER['HTTP_HOST']?>/blockbuys/details.php?route=product/product&product_id=<?php echo $fetpro['auto_id']?>&amp;t=<?php echo $fetpro['productname']?>"><img src="images/facebook.jpg" /></a>

but in facebook there is displaying hostname insted of productname. and also product image is not displaying automatically..and next total url is not comming just displaying like this.

rahul
http://rahul/blockbuys/details.php?route...

above the url actually displays my product name..but it displaying hostname. and also displaying half url only..i have faced same situation in twitter also.

0

Don't forget to end your php statements with a semi-colon.

<?php echo $_SERVER['HTTP_HOST']; ?>

I'm not sure if this is your problem though as I thought you would get errors...

Edited by darkagn: n/a

0

k...i was added like this. every thing is working fine.
but product description is not displaying there.
here is my code.

<meta name="title" content="<?=$fetpro['productname']?>" />
<meta name="description" content="Join this bloc to help me get a deal at BlocBuys!"/>
  <link rel="image_src" href="admin/product_images/60x60/<?=$fetpro['product_image']?>"/ >
<a href="http://www.facebook.com/sharer.php?u=http://www.xyz.com/xyz/details.php?pro_id=<?php echo $fetpro['auto_id']?>&t=<?php echo $fetpro['productname']?>"><img src="images/facebook.jpg" /></a>

here in facebook displaying automatically name of the product and image of the product.
but it is not displaying product discription ...i mean content which was in meta tag in my header.
so how to display description of the product direct in content field which is in facebook sharer.php page

Edited by muralikalpana: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.