Social Networking: Link Problem
I seem to be having many problems with my forum, most of them being mine.
So here goes the next one:
I am in the process of creating an additional item on the topic page that lets the member share the topic on Facebook, Twitter, and the like. I do not wan’t to use SocialIt as it puts it on every post, which starts to look messy. I have a neat forum.
So, I opened topic.php in my template’s directory and found the place where I need to add the code to achieve this.
At first, I added this, which worked: (bb_current_page_url is my own function)
<li><?php printf(__('Share this topic on <a target="_blank" href="http://www.facebook.com/sharer.php?u=%1$s">Facebook</a>' , bb_current_page_url() ?></li>
Then I wanted to add a title as per Facebook’s Sharer specifications. This means that I must add &t=<the-title>, where I put the cutom title in <the-title>.
So I did this:
<li><?php printf(__('Share this topic on <a target="_blank" href="http://www.facebook.com/sharer.php?u=%1$s&t=%2$s">Facebook</a>' , bb_current_page_url(), topic_title()) ?></li>
and it returned this:
DataSets and DataTableAdaptersShare this topic on Facebook
<string>Note: If you hover your mouse over “Facebook”, you’ll see that the URL has been cut off – which is why the title appears before the entire printf() function.
It should return this:
Share this topic on Facebook
I’m obviously doing something wrong with printf(), but I doubt it as it’s literally a copy-paste from the other printf()’s on that page.
I also want to stick to printf() as I will have multiple sites to link to, and I do not want to keep repeating things. I just want to refer to %1$s and %2$s for each entry.
Could anyone help me get out of this mess?
You must be logged in to reply to this topic.