在《给博客增加RSS订阅到Google、鲜果、抓虾、QQ邮箱功能》中介绍了给博客增加RSS订阅的功能,这些都是通过各阅读器提供的订阅按钮生成地址自动生成的,要真每个一遍遍操作一遍也是需要时间的。虽然Google Reader、鲜果等在生成订阅按钮的时候都有默认的图标,但是很可能入不了我们的法眼,最终还是要自己来实现。
因此就想到直接用代码方式实现订阅效果,首先我们要做的就是看看这个所谓的自动生成所产生的html代码,就以鲜果为例吧。
HTML语言: 知蚁博客 程序设计
<a title=“订阅到鲜果 RSS阅读器” href=“http://xianguo.com/subscribe?url=http://feed.feedsky.com/letuknowit” target=“_blank”><img src=“http://www.letuknowit.com/images/rss/xianguo.gif” border=“0″ alt=“鲜果阅读器订阅图标” /></a>
其实就是个<a>标签,给个图片指定个url地址,就这么简单,一点技术含量都没得啦!其中核心的部分是href指向的地址,这个是真正完成rss订阅功能的部分,这个是由各个rss订阅器实现的,我们不用管,我们要做的就是控制订阅按钮的样式!我们的rss源就是href中url=后面的那个地址。
下面是水母收集的一些rss阅读器的订阅代码(如果用过Feedsky,应该很容易搞到这些代码,(~ o ~)~zZ):
HTML语言: 知蚁博客 程序设计
<div><a href=“http://www.xianguo.com/subscribe.php?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_xianguo.gif” border=“0″ alt=“订阅到鲜果” /></a>
<a href=“http://www.zhuaxia.com/add_channel.php?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_zhuaxia.gif” border=“0″ alt=“订阅到抓虾” /></a>
<a href=“http://www.netvibes.com/subscribe.php?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_netvibes.gif” border=“0″ alt=“netvibes” /></a>
<a href=“http://fusion.google.com/add?feedurl=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_google.gif” border=“0″ alt=“google reader” /></a>
<a href=“http://add.my.yahoo.com/rss?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_yahoo.gif” border=“0″ alt=“my yahoo” /></a>
<a href=“http://www.rojo.com/add-subscription?resource=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_rojo.gif” border=“0″ alt=“Rojo” /></a>
<a href=“http://www.newsgator.com/ngs/subscriber/subfext.aspx?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_newsgator.gif” border=“0″ alt=“Newsgator” /></a>
<a href=“http://www.bloglines.com/sub/http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_bloglines.gif” border=“0″ alt=“bloglines” /></a>
<a href=“http://reader.youdao.com/b.do?keyfrom=feedsky&url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_youdao.gif” border=“0″ alt=“订阅到有道” /></a>
<a href=“http://mail.qq.com/cgi-bin/feed?u=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_qq.gif” border=“0″ alt=“订阅到QQ邮箱” /></a></div>
<a href=“http://www.zhuaxia.com/add_channel.php?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_zhuaxia.gif” border=“0″ alt=“订阅到抓虾” /></a>
<a href=“http://www.netvibes.com/subscribe.php?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_netvibes.gif” border=“0″ alt=“netvibes” /></a>
<a href=“http://fusion.google.com/add?feedurl=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_google.gif” border=“0″ alt=“google reader” /></a>
<a href=“http://add.my.yahoo.com/rss?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_yahoo.gif” border=“0″ alt=“my yahoo” /></a>
<a href=“http://www.rojo.com/add-subscription?resource=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_rojo.gif” border=“0″ alt=“Rojo” /></a>
<a href=“http://www.newsgator.com/ngs/subscriber/subfext.aspx?url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_newsgator.gif” border=“0″ alt=“Newsgator” /></a>
<a href=“http://www.bloglines.com/sub/http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_bloglines.gif” border=“0″ alt=“bloglines” /></a>
<a href=“http://reader.youdao.com/b.do?keyfrom=feedsky&url=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_youdao.gif” border=“0″ alt=“订阅到有道” /></a>
<a href=“http://mail.qq.com/cgi-bin/feed?u=http://feed.feedsky.com/letuknowit”><img src=“http://img.feedsky.com/images/icon_subshot02_qq.gif” border=“0″ alt=“订阅到QQ邮箱” /></a></div>
在上面代码中挑选你需要的,然后将上面代码中的”http://feed.feedsky.com/letuknowit“换成你的rss源即可。这样就不用一个个网站去弄订阅按钮代码了,至于图片,如果不满意的话,直接将上面代码中的图片的地址修改为自己的图片地址即可,上面的图片都是来自Feedsky的。
原创文章请注明转载于知蚁博客,本文地址:http://www.letuknowit.com/archives/69
来回访啦。。
欢迎来访,以后常来哦。
来咯常走动!!
呵呵,一定!
feedsky里基本都有了
呵呵,我这些就是从feedsky里挑出来的,高手就是高手啊,一眼就看出来了
蜘蛛为什么不来我的网站?!!!!!!
google的蜘蛛应该还是蛮勤快的吧
来看看了,顶顶
热烈欢迎,多谢支持
抓虾好。来顶顶,多交流
我也比较喜欢虾子,呵呵!欢迎来访!
版面很特别
谢谢!欢迎来访!
主题很清爽,不错
在原有主题上修改的,借鉴了很多优秀博客的设计,还有很多需要完善的地方
这个 我真还没有整。我不知道放我现在 这个主题的什么地方比较合适。。
刚去你博客看了下,可以和我一样放搜索的下面嘛
我还没添加这些里
可以考虑加一下的
我来顶顶。
多谢支持
谢谢博主分享~
嘿嘿,应该的,欢迎来访
不错的网站,来支持下!
多谢支持,看到你的名字我就想起在玩魔兽世界时候的会长了,呵呵
嗯 支持一个! 在feedsky里很容易找!
多谢支持!
好强呀
终于找到了,这个正是我需要的代码
希望对你有用
还真没怎么用过
我也是刚开始用
看不懂,真晕
来微博客转转吧
果然都是国内最常用的那些
rss貌似越来越不受重视了