shelbyit Posted August 25, 2011 Share Posted August 25, 2011 Hi all, I'm not great with PHP and I have this one problem that I hope you can help with. I have a script that generates an URL. The output string is $shorturl and displays properly when I echo it using <?php echo '$shorturl' ?> . However, when I try the following script for a Facebook share button <fb:share-button> <a name="fb_share" type="button" share_url="<?php echo '$shorturl' ?>" href="http://www.facebook.com/sharer.php" layout="button_count">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> </fb:share-button> The resulting URL it produces is: http://</?php+echo+%27http%3A%2F%2Fshelb... Any idea's? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/245652-help-with-facebook-share-script-link-not-displaying-properly/ Share on other sites More sharing options...
MasterACE14 Posted August 25, 2011 Share Posted August 25, 2011 I'm not sure how the facebook API works, but it looks like you only need to put the variable in there. Try this: <a name="fb_share" type="button" share_url="$shorturl" href="http://www.facebook.com/sharer.php" layout="button_count">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script> You may have to also use urldecode() on $shorturl before it's used in the sharebutton code. Quote Link to comment https://forums.phpfreaks.com/topic/245652-help-with-facebook-share-script-link-not-displaying-properly/#findComment-1261693 Share on other sites More sharing options...
shelbyit Posted August 25, 2011 Author Share Posted August 25, 2011 Hi, Thanks urldecode() worked for me. Neil. Quote Link to comment https://forums.phpfreaks.com/topic/245652-help-with-facebook-share-script-link-not-displaying-properly/#findComment-1262010 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.