PHP
  Home arrow PHP arrow Page 6 - Rockin’ RSS with PHP on your HTML
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Rockin’ RSS with PHP on your HTML
By: Danny Wall
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 41
    2004-11-23


    Table of Contents:
  • Rockin’ RSS with PHP on your HTML
  • An idea that's catching on
  • How--and why--to get started
  • Starting with the header
  • Adding content
  • Tease the reader

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Rockin’ RSS with PHP on your HTML - Tease the reader
    ( Page 6 of 6 )

    And essentially that’s it. Notice how I did NOT put the entire content into the RSS feed. You can put the entire content into the file if you want. Personally, I don’t recommend doing this. Instead, put just enough to tease the reader so that they want to visit your site.

    Now, you will note that I do move the data around just a bit to not only shorten the length of what I’m sending out on the feed, but also to add the ellipses to let readers know there is more.

    And again, how you decide to database your content will affect exactly how you pull that content out.

    Anyway, at this point, all we need to do is close off the file.

    fwrite ($fd, "</channel></rss>");
    fclose ($fd);

    ?>

    It is a simple enough process.  You can now have that ran by a cron job, or simply run the php file from a browser once a day.

    Again, if you are running some sort of a content management system (and I’ll talk about how to easily build your own in future articles), creating the RSS file is obviously a simple matter of writing the static “header” information for your site/feed, pulling the content out of the database, writing each item of new content between “<item>” tags, and then closing the file off with the ending tags.

    You may want to add in some other information into this feed, and again, we’ll also talk about what other information there is to add, and why you may want to put that into the feed. We’ll also talk about, if you are adding content via RSS feeds to your site, how to make THAT content from that OTHER feed a part of your own RSS feed. This will ensure that you’ve got a constantly updating RSS feed so that people will want to keep coming back to your site, driving up traffic, unique visitors per day, and page views per visitor.



     
     
    >>> More PHP Articles          >>> More By Danny Wall
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT