How to use PHP to insert RDF content into a Web site

Source: Internet
Author: User
Tags stock prices
Reputation and wealth imagine a site that gets the latest news from the most popular portals. Stock prices, weather information, news and stories, online discussion groups, software releases, all of which will be dynamically updated every hour without any manual intervention. We can imagine the following site traffic, a steady stream of advertising revenue, network management reputation, and huge wealth.

Imagine a site that gets the latest news from the most popular portal. Stock prices, weather information, news and stories, online discussion groups, software releases ...... All of this will be dynamically updated every hour without any manual intervention. We can imagine the following site traffic, a steady stream of advertising revenue, and the "flattering" of network administrators ".

But now, stop imagining and start reading, because as long as you pay close attention to this technology, you may become the master of the site. Your requirements are just a little imaginative, some smart PHP code and a few free RSS files. In addition, it clearly includes the remaining nine parts of this article.



If you Have any Content, you can combine the Have Content, Will Syndicate)
From the very beginning -- what is RSS?

RSS (RDF Site Summary) is a format first designed by Netscape to distribute the description of content on its portal My. Netscape. Com. Since it was proposed in 1997, there have been ups and downs-you can click the link at the end of the article to learn about the long and complex history of RSS. The current stable version is RSS1.0, which complies with the RDF specification. This version is lightweight and fully functional.

RSS makes it possible for the network administrator to promptly publish and distribute descriptions of the latest and most interesting content at a specific site. From the list of news articles to the stock market data or weather forecasts, all such information can be published through well-structured XML documents, which can also be analyzed by any XML analyzer, processing and translation.

The list of the latest information on the website is updated frequently, and RSS makes the distribution of this list possible, opening the door for the combination of simple content on the Web. For more information, see the following simple example:

Site A is A news site ("content sindiga organizer"). it can publish an RSS document containing the latest news list and corresponding links hourly. This RSS document can be obtained by other sites (such as site B and content collectors) and analyzed and displayed on the index page of Site B. Each time site A publishes A new RSS document, the index page of Site B can be automatically updated to get the latest news.

This scheme is effective for both parties in the transaction. Since the links in the RSS document all point to the corresponding articles on Site A, site A will quickly experience the increase in access traffic. The website B's network administrator can take a week off, because he can automatically update the index page on the site, this method only connects the index page with the dynamic content published by site.

There are many popular sites that provide detailed RSS or RDF news to the public, such as Freshmeat (http://www.freshmeat.net) and Slashdot (http://www.slashdot.org), and of course there are many other sites. In this article, I will extensively use the RDF file on the Freshmeat website. One thing to note is that the technology mentioned here can also be applied to any other RSS1.0 or RDF file.



Switching Channels)

A typical RSS document contains a list of resources (URLs) marked by descriptive metadata. See the following example:


Xmlns = "http://purl.org/rss/1.0/">


Trog
Well-written technical articles and
Tutorials on Web technologies

Http://www.melonfire.com/community/columns/trog/


  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 100 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 71 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 62 "/>




    Rdf: about = "http://www.melonfire.com/community/columns/trog/article.php? I
    D = 10
    0 ">
    Building a php-Based Mail Client (part 1)

    Http://www.melonfire.com/community/columns/trog/article.php? Id = 100
    Nk>
    Ever wondered how Web-based mail clients
    Work? Find out here.


    Rdf: about = "http://www.melonfire.com/community/columns/trog/article.php? I
    D = 71 ">
    Using PHP With XML (part 1)

    Http://www.melonfire.com/community/columns/trog/article.php? Id = 71 <
    /Link>
    Use PHP's SAX parser to parse XML data and
    Generate HTML pages.


    Rdf: about = "http://www.melonfire.com/community/columns/trog/article.php? I
    D = 62 ">
    Access Granted

    Http://www.melonfire.com/community/columns/trog/article.php? Id = 62 <
    /Link>
    Precisely control access to information
    With the mySQL grant tables.


    As you can see, the RDF file consists of several well-defined parts. The first is the prolog ),



    Then the namespace declaration in the root element.

    Xmlns = "http://purl.org/rss/1.0/">
    Next This part contains the general information of the channel to be described by the RDF. In the above example, the channel is the Trog column of the Melonfire website. The column content is a new technical article and guide, which is updated every week.


    Trog
    Well-written technical articles and
    Tutorials on Web technologies

    Http://www.melonfire.com/community/columns/trog/


  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 100 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 71 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 62 "/>




    The partition contains Block, The block also contains an ordered list of all resources described in the document. This list uses a series
  • Element. Every resource in the block is The block has a more detailed description.



  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 100 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 71 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 62 "/>



    You can also place In this way, you can publish the URL of the channel logo.

    For the sake of meat The block details a separate resource, including the title, URL, and resource description.



  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 100 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 71 "/>
  • Rdf: resource = "http://www.melonfire.com/community/columns/trog/article.ph
    P? Id
    = 62 "/>



    In this example, The section describes a separate article in The Ttrog "channel" and provides a description, title, and URL for this article. Content collectors can use URLs to create "backward" links.



    As you can see, the RSS1.0 file is quite intuitive and easy to create, either manually or through programming. The above examples and explanations only illustrate the nature. Generally, you can use RSS1.0 and RDF to do more things. You 'd better read the link provided at the end of the article to get more information. Before that, we will spend a few minutes discussing how to insert RSS1.0 into your own Web site.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.