A A A

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
I need to add a piece of javascript code in topic line on post page (for Twitter!)
Aug 6, 2010
5:51 pm
Member
Forum Posts: 17
Member Since:
Aug 4, 2010
Offline

Hi forums!

My forum is almost ready to go live! It's actually live right now, I just haven't started promoting it yet. Hope to by this Monday.

Check out it here:[url="http://www.themobilefanatics.com/forums"]

I want to add a TweetMeme javacript code to the topic line either right after the topic title or next to the Print icon. The code makes a "retweet" button that creates a tweet and includes the page title and a shortlink. This works on any page you put the code, on any platform – it's a really great tool for people looking to add a tweet function to their forums. I've already tested it by adding the code to my "forums" page and it works perfectly, just not placed properly. The button looks like this:

http://help.tweetmeme.com/wp-content/uploads/2009/04/compact.PNG

cool huh? Might be something to look into for a future release. Would be a great option.

I'm sure this can't be too hard. If someone can point me in the right direction I can place this code myself.

Thanks!

p.s. if anyone wants to learn more about using TweetMeme it's really great. You don't even need an account w/ them. Link: [url="http://help.tweetmeme.com/2009/04/06/tweetmeme-button/"]

Aug 6, 2010
7:42 pm
Member
Forum Posts: 17
Member Since:
Aug 4, 2010
Offline

oh and im using the "structure blue" theme. thanks!

Aug 7, 2010
1:13 am

SP Master
Forum Posts: 23698
Member Since:
Dec 10, 2006
Offline

see our wiki, the section on api… you will want the program hooks that allow you to insert code/display items in various locations throughout the forum…

Aug 7, 2010
3:08 am
Member
Forum Posts: 17
Member Since:
Aug 4, 2010
Offline

thanks. I found the code that I want to use. its the topic top pagelinks and topic bottom pagelinks.

here is the code in the wiki:

function sf_hook_post_topic_top_pagelinks($forumid, $topicid)
{
return '';
}

and here is the javascript I need to drop in:

<script type="text/javascript">
tweetmeme_style = 'compact';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts…..script>

i have nearly zero PHP and javascript experience. Your next post will help me immensely.

Aug 7, 2010
3:31 am

SP Master
Forum Posts: 22240
Member Since:
Nov 9, 2008
Offline

First – remember to rename the extension of the hooks file so it will get ncluded into the code.

Then – that script ALL goes between the two single quote marks of the 'return' statement in the hook.

However – remember that you can not mix quote marks so  the code has a single quote around it ALL (in the return statement) whch means that everything inside the code needs to be double quotes. This is true of all of it except thet 'compact' term. Change those to double quotes and you should be good to go.

Yellow Swordfish
Aug 7, 2010
4:07 am
Member
Forum Posts: 17
Member Since:
Aug 4, 2010
Offline

you are the best!

I got a Retweet button below the topic title and below the tags on the bottom. Perfect thank you very much.

Look here!

I'm planning on adding a big Tweet This graphic w/ the bird to the left of the buttons to jazz up the forums a bit. many of my readers are twitter users so this will come in handy. HIGHLY recommend this way for others looking for a way to tweet their Simple:Press forum posts.

thanks again for the help. I learned so much about hooks and a little about php.

Aug 7, 2010
4:29 am

SP Master
Forum Posts: 22240
Member Since:
Nov 9, 2008
Offline

That's great. Looks OK. And… does it work?

Yellow Swordfish
Aug 7, 2010
11:17 am

SP Moderator
Forum Posts: 606
Member Since:
Jul 17, 2010
Offline

That came out pretty cool.  Nice work :)

Aug 7, 2010
11:36 am
Member
Forum Posts: 17
Member Since:
Aug 4, 2010
Offline

thanks guys! it works. give it a try if you want. click the button and it pulls the page title, shortens the link, and lets a user retweet the topic. it also drops my twitter username at the end so people know where it came from.

there is literally ZERO work on the twitter side to get that button. Just follow the link I gave you to TweetMeme and drop that javascript into the hooks.

Hopefully this is helpful to some users.

Aug 7, 2010
11:03 pm

SP Master
Forum Posts: 23698
Member Since:
Dec 10, 2006
Offline

thanks mikemacias… there really is quite a lot you can do using the program hooks…  coming in v5.0 is planned a full plugin api to allow more user interaction and actual plugins that can be distributed…

Forum Timezone: America/Chicago

Most Users Ever Online: 444

Currently Online: wazina
66 Guest(s)

Currently Browsing this Page:
1 Guest(s)

See All Online Activity

Top Posters:

-Radio-: 1251

Lee H: 606

Luffer: 535

Conrad_Farlow: 504

jim: 478

neon: 263

ovizii: 240

Tal: 240

Member Stats:

Guest Posters: 2626

Members: 7364

Moderators: 1

Admins: 2

Forum Stats:

Groups: 5

Forums: 16

Topics: 10903

Posts: 79603

Moderators: Brandon C (162)

Administrators: Yellow Swordfish (22240), Mr Papa (23698)