如何添加共享,如Web应用程序中的(facebook)按钮 [英] How to ADD share, like (facebook) buttons in a web application

查看:49
本文介绍了如何添加共享,如Web应用程序中的(facebook)按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在开发一个与职业指导相关的网络应用程序。我需要在我们的网络应用程序中使用facebook,twitter和LinkedIn等按钮。当我点击应用程序中的按钮时,我们的日期应该分享到这些网站。请帮我提供代码。



提前谢谢。

解决方案

这里你去;)



[来自特色文章,见下文]



其中大部分按钮通过JavaScript工作。如果您有一个标准的静态HTML站点,您可能知道应放置js的位置。如果你正在使用Joomla!,它有点棘手。首先,导航到模板文件夹中找到的index.php文件。在记事本中打开它并滚动到文件的底部。然后,在结束之前<   / body  > 标记,在以下示例代码中添加Google +1和Twitter:
< script type = < span class =code-keyword> text / javascript src = http://apis.google.com/js/plusone.js > < / script >
< script type = text / javascript src = http://platform.twitter.com/widgets.js > < / script >

然后将HTML代码放在您希望按钮显示的网页中。对于Joomla !,我发现最简单的方法是创建一个带有特殊位置{loadposition social}的自定义HTML模块,用于将按钮直接放入文章中。我通常将它直接放在主图像的下方,并在引入段落之后。

如果您在Joomla!中工作,并且您正在使用TinyMCE编辑器,则需要关闭代码清理选项。然后记得在创建模块后重新打开它们。

以下是Google +1,Twitter,Reddit和Delicious的代码:
< g:plusone > < / g:plusone >

< a href = http://twitter.com/share class = twitter-share-button < span class =code-attribute> data-count = vertical data-vi a = YourSite > Tweet < / a >

< a href = http:// www.reddit.com/submit\" onclick = window.location ='http://www.reddit.com/submit?url='+ encodeURIComponent(window.location);返回false > < img src = < span class =code-keyword> http://www.reddit.com/static/spreddit7.gif alt = 提交到reddit border = 0 / > < / a >

< img src = http://l.yimg .com / hr / img / delicious.small.gif height = 10 width = 10 alt = 美味 / >
< span class =code-keyword><
a href = http://www.delicious.com/save onclick = window.open( 'http://www.delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(location.href)+' &安培;标题='+ encodeURIComponent方法(document.title时),'美味','toolbar = no,width = 550,height = 550');返回false; > 在Delicious < / a >

Facebook按钮有点复杂,你不仅可以喜欢文章,但您也可以从Facebook墙上的按钮添加评论。由于增加的复杂性,我确实使用了Verge的模块。这个模块是免费的,并提供自动URL发现功能,这意味着你可以将此按钮添加到您网站的每个页面,当有人喜欢它时,该特定页面将被链接到,而不是首页。







如何在网站上添加社交网络按钮 [ ^ ]





干杯,

Edo


您可以使用下面的链接在您的网站上添加facebook的分享/链接按钮



http ://developers.facebook.com/docs/reference/plugins/like/

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.

解决方案

Here you go ;)

[from featured article, see below]

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


You can use the link below to add share/link button of facebook in your site

http://developers.facebook.com/docs/reference/plugins/like/


这篇关于如何添加共享,如Web应用程序中的(facebook)按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆