5

I'm doing:

$fb = "http://www.facebook.com/sharer.php?t=".$title."&u=".$url;

That line is inside a while loop getting results from database. $url is always the same one but $title changes depending on the row.

Now I build the links and when I click them, they always show in my Wall the

<meta name="title" content=''>

text from my main page and not the $title text.

What can I do to fix this and share the text contained in $title?

Here the code I'm trying with og. After hitting the link the share text in my Wall is "Google" instead of what is in my variables:

<?php
$tt = "Some text in the meta";
    $url_p = "http://www.google.com";
        $url = urlencode($url_p);
        $text = "Text I want to show";
        $title = urlencode($text);
$fb = "http://www.facebook.com/sharer.php?t=".$title."&u=".$url;
?>
<meta property="og:title" content="<?php echo $tt; ?>"/>

<a href="<?php echo $fb; ?>">share link</a>
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
user712027
  • 572
  • 6
  • 9
  • 22

3 Answers3

1

This isn't currently possible via the sharer API if your url is 'always the same' and please include any relevant code since I cannot see how your, 'ine is inside a while loop getting results from database'.

live87
  • 41
  • 5
  • I've added a random number at the end of the url so it is different everytime: http://mypage.com/folder/index.php?1451988335 being 1451988335 the number that changes but no advance :( – user712027 Aug 05 '11 at 09:46
1

How are you generating your meta tags? Are your trying to follow the open graph protocol? If so, your 'name' should be 'og:title'.

live87
  • 41
  • 5
  • 1
    I have my main's page meta tag, just one. That's where the sharer is taking the text from. The url links a perfecly formed: – user712027 Aug 05 '11 at 09:23
  • www.facebook.com/sharer/sharer.php?t=Text+from+database+belonging+to+row+id+1&u=http%3A%2F%2Fmypage.com%2folder – user712027 Aug 05 '11 at 09:23
  • but the sharer don't show in my Wall "Text from database belonging to row id 1" it shows what I have in my main's page meta tag. I'll try changing the url into a dynamic one also. – user712027 Aug 05 '11 at 09:27