返回   CHF站长论坛 > 特色讨论区 > ExpressionEngine交流专栏

ExpressionEngine交流专栏 ExpressionEngine是一个基于PHP的非常强大灵活的CMS。[官方]

双至强仅二千,企商在线,最早租用商 传世私服 魔域私服 亿恩1元帮您升级服务器! 天龙八部私服 传奇世界私服
传奇私服 仙境私服 天龙八部私服 传奇私服 传世私服 完美世界私服 魔域私服 传奇私服
发表新主题 回复
 
主题工具 主题评分 显示模式
旧 2006-11-14, 11:20   #1 (页面定位)
老鬼
CH重振中
 
老鬼 的头像
 
注册日期: 2005-08-30
住址: 地球
帖子: 12396
老鬼 的声望功能已被禁用
默认 用EE的Magpie做个不用更新的网站

我偷百度的科技新闻RSS,列出5条最新的
代码:
		{exp:magpie url="http://news.baidu.com/n?cmd=1&class=internet&tn=rss" limit="5" refresh="60"}
		<ul>
		{items}
		<li><a href="{link}">{title}</a></li>
		{/items}
		</ul>
		{/exp:magpie}
这个插件是基于缓存的,所以不会每次打开都去获取数据,refresh="60"这里是设置多长时间去获取一次最新的新闻,按分钟算的,获取到的数据保存在缓存里,所以平时都是访问本地的数据,不会影响速度

任何一个网站的RSS都可以,只要RSS里面有的tag就可以调用出来,具体变量可以看下面的说明



控制面板首页 › 管理 › 其他配置 › 插件管理 › Magpie
插件信息
名字 Magpie RSS Parser
版本 1.3.3
作者 Paul Burdick
作者 URL http://www.pmachine.com/
描述 Retrieves and Parses RSS/Atom Feeds
Usage
STEP ONE:
Insert plugin tag into your template. Set parameters and variables.

PARAMETERS:
The tag has three parameters:

1. url - The URL of the RSS or Atom feed.

2. limit - Number of items to display from feed.

3. refresh - How often to refresh the cache file in minutes. The plugin default is to refresh the cached file every three hours.


Example opening tag: {exp:magpie url="http://www.pmachine.com/news.rss" limit="8" refresh="720"}

SINGLE VARIABLES:

feed_version - What version of RSS or Atom is this feed
feed_type - What type of feed is this, Atom or RSS
page_url - Page URL of the feed.

image_title - [RSS] The contents of the &lt;title&gt; element contained within the sub-element &lt;channel&gt;
image_url - [RSS] The contents of the &lt;url&gt; element contained within the sub-element &lt;channel&gt;
image_link - [RSS] The contents of the &lt;link&gt; element contained within the sub-element &lt;channel&gt;
image_description - [RSS] The contents of the optional &lt;description&gt; element contained within the sub-element &lt;channel&gt;
image_width - [RSS] The contents of the optional &lt;width&gt; element contained within the sub-element &lt;channel&gt;
image_height - [RSS] The contents of the optional &lt;height&gt; element contained within the sub-element &lt;channel&gt;

channel_title - [ATOM/RSS-0.91/RSS-1.0/RSS-2.0]
channel_link - [ATOM/RSS-0.91/RSS-1.0/RSS-2.0]
channel_modified - [ATOM]
channel_generator - [ATOM]
channel_copyright - [ATOM]
channel_description - [RSS-0.91/ATOM]
channel_language - [RSS-0.91/RSS-1.0/RSS-2.0]
channel_pubdate - [RSS-0.91]
channel_lastbuilddate - [RSS-0.91]
channel_tagline - [RSS-0.91/RSS-1.0/RSS-2.0]
channel_creator - [RSS-1.0/RSS-2.0]
channel_date - [RSS-1.0/RSS-2.0]
channel_rights - [RSS-2.0]


PAIR VARIABLES:

Only one pair variable, {items}, is available, and it is for the entries/items in the RSS/Atom Feeds. This pair
variable allows many different other single variables to be contained within it depending on the type of feed.

title - [ATOM/RSS-0.91/RSS-1.0/RSS-2.0]
link - [ATOM/RSS-0.91/RSS-1.0/RSS-2.0]
description - [RSS-0.91/RSS-1.0/RSS-2.0]
about - [RSS-1.0]
atom_content - [ATOM]
author_name - [ATOM]
author_email - [ATOM]
content - [ATOM/RSS-2.0]
created - [ATOM]
creator - [RSS-1.0]
date - [RSS-2.0]
description - [ATOM]
id - [ATOM]
issued - [ATOM]
modified - [ATOM]
subject - [ATOM/RSS-1.0]
summary - [ATOM/RSS-1.0/RSS-2.0]


EXAMPLE:

{exp:magpie url="http://www.pmachine.com/news.xml" limit="10" refresh="720"}
<ul>
{items}
<li><a href="{link}">{title}</a></li>
{/items}
</ul>
{/exp:magpie}


***************************
Version 1.2
***************************
Complete Rewrite That Improved the Caching System Dramatically

***************************
Version 1.2.1 + 1.2.2
***************************
Bug Fixes

***************************
Version 1.2.3
***************************
Modified the code so that one can put 'magpie:' as a prefix on all plugin variables,
which allows the embedding of this plugin in a {exp:weblog:entries} tag and using
that tag's variables in this plugin's parameter (url="" parameter, specifically).

{exp:magpie url="http://www.pmachine.com/news.xml" limit="10" refresh="720"}
<ul>
{magpie:items}
<li><a href="{magpie:link}">{magpie:title}</a></li>
{/magpie:items}
</ul>
{/exp:magpie}

***************************
Version 1.2.4
***************************
Added the ability for the encoding to be parsed out of the XML feed and used to
convert the feed's data into the encoding specified in the preferences. Requires
that the Multibyte String (mbstring: http://us4.php.net/manual/en/ref.mbstring.php)
library be compiled into PHP.

***************************
Version 1.2.5
***************************
Fixed a bug where the Magpie library was adding slashes to the cache directory
without doing any sort of double slash checking.

***************************
Version 1.3
***************************
Fixed a bug where the channel and image variables were not showing up because of a bug
introuced in 1.2.

***************************
Version 1.3.1
***************************
New parameter convert_entities="y" which will have any entities in the RSS feed converted
before being parsed by the PHP XML parser. This is helpful because sometimes the XML
Parser converts entities incorrectly. You have to empty your Magpie cache after enabling this setting.

New parameter encoding="ISO-8859-1". Allows you to specify the encoding of the RSS
feed, which is sometimes helpful when using the convert_encoding="y" parameter.

***************************
Version 1.3.2
***************************
Eliminated all of the darn encoding parameters previously being used and used the
encoding abilities recently added to the Magpie library that attempts to do all of the
converting early on.

***************************
Version 1.3.3
***************************
The Snoopy library that is included with the Magpie plugin by default was causing
problems with the Snoopy library included in the Third Party Linklist module, so
the name was changed to eliminate the conflict.
老鬼 当前离线   回复时引用此帖
旧 2006-11-14, 13:04   #2 (页面定位)
fen©
 
fen 的头像
 
注册日期: 2005-12-18
帖子: 2864
fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星fen 绝对是天王巨星
默认

fen 当前离线   回复时引用此帖
旧 2006-11-14, 13:27   #3 (页面定位)
amio
 
注册日期: 2006-06-02
帖子: 70
amio 是普普通通的会员
默认

也可以做成几个blogger的共同发布平台
amio 当前离线   回复时引用此帖
旧 2006-11-14, 22:48   #4 (页面定位)
srsman
 
srsman 的头像
 
注册日期: 2005-11-08
帖子: 1758
srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦srsman 身上有一圈迷人的光环哦
默认

呵呵!淫荡贴!
srsman 当前离线   回复时引用此帖
旧 2006-11-15, 21:53   #5 (页面定位)
找不到符号
 
找不到符号 的头像
 
注册日期: 2005-10-29
帖子: 261
找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人找不到符号 是一个将要出名的人
默认

不用采集的资源积累


CH
找不到符号 当前离线   回复时引用此帖
旧 2006-12-02, 16:53   #6 (页面定位)
橘子和狼
 
注册日期: 2006-09-12
帖子: 38
橘子和狼 是普普通通的会员
默认

没看懂怎么使用
橘子和狼 当前离线   回复时引用此帖
旧 2007-01-25, 11:55   #7 (页面定位)
aman.t.o.b
 
注册日期: 2006-09-17
帖子: 3
aman.t.o.b 是普普通通的会员
默认

能发表到一个分类的条目中吗?一个新闻一个条目。?
aman.t.o.b 当前离线   回复时引用此帖
旧 2007-01-29, 12:53   #8 (页面定位)
mycbbs
 
注册日期: 2007-01-27
帖子: 89
mycbbs 是普普通通的会员
默认

真是不错,好东东
mycbbs 当前离线   回复时引用此帖
旧 2007-02-02, 17:19   #9 (页面定位)
swsw007©
 
swsw007 的头像
 
注册日期: 2006-07-04
帖子: 1122
swsw007 是普普通通的会员
默认

老鬼真强


据说价值5000元的seo电子书
每天锻炼一小时,健康工作50年,幸福生活一辈子
网站建设/seo服务 创业帮 电子商务 网络营销
swsw007 当前离线   回复时引用此帖
旧 2007-02-05, 12:14   #10 (页面定位)
kan108
 
注册日期: 2005-11-20
帖子: 81
kan108 是普普通通的会员
默认

这个不错
kan108 当前离线   回复时引用此帖
回复

书签

标签

主题工具
显示模式 对此主题评分
对此主题评分:



所有时间均为北京时间。现在的时间是 22:53