MyBB Community Forums

Full Version: Tweet this thread Button query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to add a Tweet this thread button for postbit_classic..

Code:

<div class="topbarsubsegright" id="custom-tweet-button">
<a href="http://twitter.com/share?url={$mybb->settings['bburl']}/{$thread['threadlink']}&text={$thread['subject']}" target="_blank" rel="nofollow">
<img alt="Tweet" src="images/tweet25px.png" title="Tweet this"></img>
</a>
</div>

What I'm trying to do it to pass the URL of the thread and the thread subject to the tweet.

Eg:
Thread title is "New info about ROM"
Thread URL is http://localhost/clonedec07/showthread.p...545#pid545

I want it to go to Twitter and display this:

New info about ROM http://localhost/clonedec07/showthread.p...545#pid545

The <a> code I used only seems to display only the text. If I append the URL like this:

<a href="http://twitter.com/share?url={$mybb->settings['bburl']}/{$thread['threadlink']}&text={$thread['subject']}%20{$mybb->settings['bburl']}/{$thread['threadlink']}" target="_blank" rel="nofollow">

Then it displays text followed by a partial URL which seems to be broken at the first forward slash "/" that appears in the thread title.
FYI, this is solved:

<a href="http://twitter.com/share?url=<func urlencode>{$mybb->settings['bburl']}</func>/showthread.php?tid={$tid}&t={$thread['subject']}&text={$thread['subject']} <func urlencode>{$mybb->settings['bburl']}</func>/showthread.php?tid={$tid}&t={$thread['subject']}" target="_blank" rel="nofollow"> 


Thread url is parsed with:
<func urlencode>{$mybb->settings['bburl']}</func>/showthread.php?tid={$tid}