如何用PHP把RDF内容插入Web站点之中_PHP
名誉和巨大的财富
设想一个从最热门的门户网站获得最新的新闻的站点。股票价格,天气信息,新闻故事,线式讨论组,软件发布……所有这一切都将被动态更新,每小时一次,不需要任何手工干预。我们可以想象这随之而来的站点访问量,源源不断的广告收入以及网管大人所受到的“阿谀奉承”。
但是现在,停止幻想,开始阅读,因为只要你密切关注此项技术,说不定你就能成为站点的主人。 对你的要求也只是稍许的想象力,一些聪明的PHP编码和几个免费的RSS文件。另外,很明显还包括这篇文章剩下的九个部分。
有内容,就联合成辛迪加(Have Content, Will Syndicate)
我们从最基本的开始——那么RSS究竟是什么鬼东西呢?
RSS(即RDF Site Summary)是一种格式,最早由Netscape公司设计,用于分发其门户站点My.Netscape.Com上的内容的描述信息。自1997年被提出以来,几经沉浮——可以点击文章末尾的链接,了解一下RSS悠久复杂的历史。现在的稳定的版本是RSS1.0,符合RDF规范。这一版本可以说即轻便又功能齐全。
RSS使得网管及时公布和分发某一特定站点的特定位置的最新最有趣的内容的描述信息变的可能。 从新闻文章列表到股票市场数据或着是天气预报,所有这些信息都可以通过结构良好的XML文档来发布,从而也可以被任何XML分析器进行分析,处理和翻译。
网站上最新信息的列表是经常更新的,而RSS使得这一列表的分发成为可能,也就为Web上简易的内容辛迪加联合打开了大门。想了解这其中的道理,请看下面这个简单的例子:
站点A,属新闻站点(“内容辛迪加组织者”),能够每小时发布一个包含最新新闻列表以及相应链接的RSS文档。 而这一RSS文档可以被其它站点获取(如站点B,“内容收集者”),分析并显示在站点B的索引页面上。 每次站点A发布一个新的RSS文档,站点B的索引页面都可以自动更新,以获取最新的新闻。
这种方案对交易中的双方机构都有效。 既然RSS文档中的链接都指向站点A上相应的文章,那么站点A将迅速体验到访问量的增加。 而站点B的网管可以休假一个星期,因为他有办法自动更新其站点上的索引页面,而这一方法仅仅是把索引页面与站点A发布的动态内容相连接而已。
有许多受欢迎的站点向公众提供详细的RSS或RDF新闻,如Freshmeat(http://www.freshmeat.net)和Slashdot(http://www.slashdot.org),当然还有其它许多站点。在这篇文章当中,我将广泛的使用Freshmeat网站的RDF文件。需要说明的一点是,这里所谈到的技术也可以应用于其它任何RSS1.0或RDF文件。
交换频道(Switching Channels)
典型的RSS文档包含一个由描述性元数据标记出来的资源列表(URLs),请看下面的例子:
?>
rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">
channel rdf:about="http://www.melonfire.com/">
title>Trog/title>
description>Well-written technical articles and
tutorials on Web technologies/description>
link>http://www.melonfire.com/community/columns/trog/
p?id
=100" />
p?id
=71" />
p?id
=62" />
d=10
0">
http://www.melonfire.com/community/columns/trog/article.php?id=100
nk>
work? Find out here.
d=71">
http://www.melonfire.com/community/columns/trog/article.php?id=71/link>
generate HTML pages.
d=62">
http://www.melonfire.com/community/columns/trog/article.php?id=62/link>
with the mySQL grant tables.
你可以看到,RDF文件由几个界限分明的部分组成。首先是文档序码(prolog),
?>
然后是根元素中的名称空间声明。
rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">
接着是channel>部分,这部分包含了RDF所要描述的频道的一般信息。在上面的例子中,频道是Melonfire网站的Trog专栏,专栏内容是新的技术文章和指南,每星期更新一次。
channel rdf:about="http://www.melonfire.com/">
title>Trog/title>
description>Well-written technical articles and
tutorials on Web technologies/description>
link>http://www.melonfire.com/community/columns/trog//link>
items>
rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=71" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=62" />
/rdf:Seq>
/items>
/channel>
channel>区包含了一个items>区块,items>区块又包含了文档中描述的所有资源的一个顺序列表。该列表通过一系列的li />元素来表示。区块中每一个资源都在后面的item>区块中有更详细的描述。
items>
rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=71" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=62" />
/rdf:Seq>
/items>
还可以在其中放置一个image>区块,这样你就可以发布频道标志的URL。
所以为了肉,RSS1.0文档中的每一个item>区块都更详细地描述一个单独的资源,包括标题,URL和资源描述。
items>
rdf:Seq>
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=100" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=71" />
li
rdf:resource="http://www.melonfire.com/community/columns/trog/article.ph
p?id
=62" />
/rdf:Seq>
/items>
在这个例子里,item>区块描述了Ttrog“频道”中单独的一篇文章,并为这篇文章提供了描述和标题,以及URL。内容收集者可以利用URL创建“向后”链接。
你看得到,RSS1.0文件相当地直观明了,不管是手工,还是通过编程,都非常容易创建。上面的例子和解释仅仅是说明性质的,通常,你可以用RSS1.0和RDF做更多的事情。你最好看一下文章末尾提供的链接,以获取更多的信息。不过在这之前,我们再花几分钟讨论一如何将RSS1.0文档插入到你自己的Web站点之中。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



When logging into iTunesStore using AppleID, this error saying "This AppleID has not been used in iTunesStore" may be thrown on the screen. There are no error messages to worry about, you can fix them by following these solution sets. Fix 1 – Change Shipping Address The main reason why this prompt appears in iTunes Store is that you don’t have the correct address in your AppleID profile. Step 1 – First, open iPhone Settings on your iPhone. Step 2 – AppleID should be on top of all other settings. So, open it. Step 3 – Once there, open the “Payment & Shipping” option. Step 4 – Verify your access using Face ID. step

If you find event ID 55, 50, 140 or 98 in the Event Viewer of Windows 11/10, or encounter an error that the disk file system structure is damaged and cannot be used, please follow the guide below to resolve the issue. What does Event 55, File system structure on disk corrupted and unusable mean? At session 55, the file system structure on the Ntfs disk is corrupted and unusable. Please run the chkMSK utility on the volume. When NTFS is unable to write data to the transaction log, an error with event ID 55 is triggered, which will cause NTFS to fail to complete the operation unable to write the transaction data. This error usually occurs when the file system is corrupted, possibly due to the presence of bad sectors on the disk or the file system's inadequacy of the disk subsystem.

How to add trusted sites in Google Chrome? Some users cannot browse the web normally because the page prompts that it is not secure when surfing the Internet. At this time, they can add the website as a trusted site, and we can access it normally and surf the Internet smoothly. The editor below will bring you the steps to add a trusted site in Google Chrome. The steps are simple and easy to operate, and even beginners can easily get started. Friends who need it can learn about it together. How to add a trusted site in Google Chrome: 1. Open Google Chrome and click the three dots in the upper right corner. Click [Settings]. Choose privacy settings and security. (As shown in the picture) 2. Click Website Settings at the bottom of the page. (As shown in the picture) 3. Click on the unsafe content at the bottom of the page. (As shown in the picture) 4. Click the Add button to the right of the Allow option. (As shown in the picture) 5. Lose

Especially over the past decade, mobile devices have become the primary way to share content with friends and family. The easy-to-access, easy-to-use interface and ability to capture images and videos in real time make it a great choice for creating and sharing content. However, it's easy for malicious users to abuse these tools to forward unwanted, sensitive content that may not be suitable for viewing and does not require your consent. To prevent this from happening, a new feature with "Sensitive Content Warning" was introduced in iOS17. Let's take a look at it and how to use it on your iPhone. What is the new Sensitive Content Warning and how does it work? As mentioned above, Sensitive Content Warning is a new privacy and security feature designed to help prevent users from viewing sensitive content, including iPhone

Usage of MINUS in SQL and specific code examples In SQL, MINUS is an operator used to perform a difference operation between two result sets. It is used to delete the same rows from the first result set as in the second result set. The result set returned by the MINUS operator will contain rows that exist only in the first result set. The following uses specific code examples to demonstrate the usage of MINUS: Assume there are two tables - "table1" and "table2", their structures are as follows: Table name: table1 field

In Alibaba software, once you successfully register an account, the system will assign you a unique ID, which will serve as your identity on the platform. But for many users, they want to query their ID, but don't know how to do it. Then the editor of this website will bring you detailed introduction to the strategy steps below. I hope it can help you! Where can I find the answer to Alibaba ID: [Alibaba]-[My]. 1. First open the Alibaba software. After entering the homepage, we need to click [My] in the lower right corner; 2. Then after coming to the My page, we can see [id] at the top of the page; Alibaba Is the ID the same as Taobao? Alibaba ID and Taobao ID are different, but the two

How to change the page that opens the Microsoft Edge browser to 360 navigation? It is actually very simple, so now I will share with you the method of changing the page that opens the Microsoft Edge browser to 360 navigation. Friends in need can take a look. I hope Can help everyone. Open the Microsoft Edge browser. We see a page like the one below. Click the three-dot icon in the upper right corner. Click "Settings." Click "On startup" in the left column of the settings page. Click on the three points shown in the picture in the right column (do not click "Open New Tab"), then click Edit and change the URL to "0" (or other meaningless numbers). Then click "Save". Next, select "

Where can I check the Tencent Video ID? There is an exclusive ID in the Tencent Video APP, but most users do not know how to check the Tencent Video ID. Next is the graphic tutorial on how to check the Tencent Video ID brought by the editor for users who are interested. Users come and take a look! Tencent Video Usage Tutorial Where to check Tencent Video ID 1. First open the Tencent Video APP and enter the special area through [Personal Center] in the lower right corner of the main page; 2. Then enter the Personal Center page and select the [Settings] function; 3. Then go to Settings page, click [Exit Account] at the bottom; 4. Finally, you can view the exclusive ID number on the page shown below.
