Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hi,

I am developing a web application related to career guidance. I need buttons like facebook, twitter and LinkedIn in our web application. When I click button in the application our date should be shared on to those websites. Please help me with the code.

Thanks in advance.
Posted

Here you go ;)

[from featured article, see below]

XML
Most of these buttons work through JavaScript. If you have a standard, static HTML site, you probably know where the js should be placed. If you're using Joomla!, it's a bit trickier. First, navigate to the index.php file that is found within the template folder. Open that up in Notepad and scroll to the bottom of the file. Then, right before the closing </body> tag, add in the following example code for Google +1 and Twitter:
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>

Then place the HTML code in the web page where you want the button to appear. For Joomla!, I found it easiest to create a custom HTML module with a special position {loadposition social} that I use to directly place the buttons into the article. I typically place it directly below the main image and right after the introduction paragraph.

If you're working in Joomla!, and you're using TinyMCE editor, you do need to turn off the Code Cleanup options. Then remember to turn them back on when you're done creating the module.

Here's the code for the Google +1, Twitter, Reddit and Delicious:
<g:plusone></g:plusone>

<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="YourSite">Tweet</a>

<a href="http://www.reddit.com/submit" onclick="window.location = 'http://www.reddit.com/submit?url=' + encodeURIComponent(window.location); return false"> <img src="http://www.reddit.com/static/spreddit7.gif" alt="submit to reddit" border="0" /> </a>

<img src="http://l.yimg.com/hr/img/delicious.small.gif" height="10" width="10" alt="Delicious" />
<a href="http://www.delicious.com/save" onclick="window.open('http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550'); return false;"> Bookmark this on Delicious</a>

The Facebook button is a bit more complex in that not only can you Like the article, but you can also add a comment from the button that appears on your Facebook wall. Because of the added complexity, I did resort to a module from Verge. This module is free and offers an automatic URL discovery feature, which means you can add this button to every page of your site, and when someone Likes it, that specific page will be linked to, as opposed to say the front page.



How-to-add-social-networking-buttons-on-your-site.html[^]


Cheers,
Edo
 
Share this answer
 
v2
You can use the link below to add share/link button of facebook in your site

http://developers.facebook.com/docs/reference/plugins/like/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900