Error when implementing sharing for facebook

Asked

Viewed 186 times

1

Follow the code I have:

<div id="fb-root"></div>
<script>(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/pt_BR/sdk.js#xfbml=1&version=v2.5";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Then some more code:

<meta property="og:title" content="<?php echo $titulorowimvtopo ?>" />
<meta property="og:description" content="<?php echo $descricaorowimvtopo ?>" />
<meta property="og:image" content="http://www.roteirodoimovel.com.br/cp/clientes/<?php echo $cliente ?>/<?php echo $idimovel ?>/<?php echo $idfototopoid; ?>" />
<meta property="fb:app_id" content="966242223397117" />

And finally the implementation for the display of the share and like button:

<div class="fb-like" data-href="http://www.<?php echo $_SERVER["HTTP_HOST"]; ?>/detalhes.php?cliente=1&idimovel=6" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>

As you can see the code has PHP implementations to streamline the process, but on all pages the image, title and description are the same. What should not happen, since each page has its own title, image and description.

How to solve this?

  • Where it’s coming from $titulorowimvtopo and $descricaorowimvtopo? You’re sure they’re right on every page?

2 answers

2

1

At the time of sharing that always appears the same data right? If it is, it must be because in div the data is static, and not dynamic as in the tag meta. Is that not it?

<div class="fb-like" data-href="http://www.<?php echo $_SERVER["HTTP_HOST"]; ?>/detalhes.php?cliente=<?php echo $cliente ?>&idimovel=<?php echo $idimovel ?>" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.