I'm sure it has been answered, but I looked around but could not find the answer. So let me ask and show what I am doing.
I am retrieving a set of articles from a DB and looping. It all works fine but I have tried to implement the "Share This" social networking tool. It works fine if I add text to the Summary manually but If I try to use a variable (preferred) from the DB for this it does not. So I am guessing it is something I am doing or it is the "Share This" limitations.
Here is what I am doing.(I have removed some extraneous code) I have created the $share_summary using the utf8_encode() because they said it had to be utf8. It did not work before so I thought this was the issue. I was using the $page_title varialbe.
The last part is the Share this Java Script. If i replace the text I have manually entered in the summary variable with the $share_summary the php script works and everything renders but the Share This tool will not appear, like the java chokes or there is some limitation on the Share This tool.
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$id = $row['0'];
$article = stripslashes($row['1']);
$page_title = stripslashes($row['2']);
$display = stripslashes($row['3']);
$date = $row['4'];
$category = $row['5'];
$share_summary = utf8_encode($page_title);
$articles .= "<table align=\"center\" width=\"90%\"><td align=\"left\">\r\n";
if ((strlen(trim($display))) < (strlen(trim($article))))
{
do something
}
else
{
do something
}
$articles .= "<p><a href=\"javascript:modalWindow('/a_link.php?a=http://www.sailinganarchy.com/z_article.php?get=$id', 460, 150)\">Perma Link</a> <script language=\"javascript\" type=\"text/javascript\">
SHARETHIS.addEntry({
title:'Sailing Anarchy Article',
url:'http://www.sailinganarchy.com/z_article.php?get=$id',
summary:'Click above or the icon to read me',
icon: 'http://www.sailinganarchy.com/gif/sab.gif'
}, {button:true} );
</script></p>";
}
So the first question is "Should summary:'$share_summary', work?
or
Is there a limitation on Share This that someone knows about, because I cannot get an answer over at Share this concerning string lengths or whitespace in the summary variable?
Like I mentioned before it works with manually entered strings but not a $php variable.
Thanks
Dave