0

Hello,

I have this code that shows fb share button which I intend my code to share the article title instead of only the url. how?

event_article.php

<html>

<link href= "css/events.css" rel="stylesheet" type="text/css" media="screen">

<!-- OpenGraph Facebook Meta Tags -->
<meta property="og:title" content="Website Title />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://www.website.com/" />
<meta property="og:image" content="http://imageurl.com" />
<meta property="og:site_name" content="Website Name" />


<?php include('includes/navigation.php'); ?>

<body>
<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/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div id="titlebar"><div id="title"><h2 class="title">Events</h2></title></div>

<div id="container">


<div id="banner">
<div id="desc">
<h1></h1>


<br><br><br>
<?php

include('include/con_database.php');

$result = mysql_query("SELECT * FROM dynamic_content WHERE id='".$_GET["id"]."'");

while ($data = mysql_fetch_array($result)){

echo '<center>'.'<div id="title">'.$data['title'].'</div>'.'</center>'.'<br>';
echo '<center>'.'<div id="images">'.'<img src="images/events/' . $data['images'] . '" >'.'</div>'.'</center>'.'<br>';
/*height="300px" width="400px" */
echo '<div id="text">'.$data['content'].'</div>'.'<br>';

echo '<div class="fb-share-button" data-href="http://127.0.0.1/IndonusaCMS/event_article.php?id=137" data-type="button_count"></div>';

echo '<div class="fb-share-button" data-type="button_count"></div>';
echo '<br><br>';

/* http://localhost/IndonusaCMS/event_article.php?id='.$_GET["id"].' 

*/

echo '<div id="twitter"><a href="https://twitter.com/share" class="twitter-share-button" data-text="'.$data['title'].'">Tweet</a></div>';

}
?>

<br><br>

<div class="fb-share-button" data-type="button_count"></div>

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

</div>

<br><br>


</div>

</body>

<br><br><br><br>
<div id="footer">
<?php include('includes/footer.php'); ?>
</div>

</html>

This is the only url that shows in fb whenever other people click on the share button: http://127.0.0.1/IndonusaCMS/event_article.php?id=137

I would like to show the article title, how to do so?

1
Contributor
1
Reply
6
Views
3 Years
Discussion Span
Last Post by davy_yg
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.