Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 01-13-2005, 02:34 PM Php - Xml - Rss
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Hi everyone,

I am not being lazy, honest!, but recently i've been getting such good answers from you guys.

I am about to develop the news section of my website which i would like to make available via an RSS/XML feed.

Now i'd rather get it right from the beginning.

So, how do i make the RSS feed?
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
 
Register now for full access!
Old 01-15-2005, 12:22 AM
foobar's Avatar
Extreme Talker

Posts: 225
Trades: 0
I'm sure if you Google it, you'll get many answers to your question. I wouldn't know, since I've never made one myself, but I'm guessing you'll have to write an XML file, and probly a DTD also.
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Old 01-15-2005, 12:57 AM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Read about RSS here (XML.com) and a more indepth specification here.

You need to know what tags a RSS can and should have, after that it's easy. After all, it's simply plain text and you can generate it as easily as outputting normal content on your own page. For example:

PHP Code:
<?php ob_start(); ?>

<?xml version="1.0"?>
<rss version="2.0">
    <channel>
        <title>MySite - The best site ever</title>
        <link>http://mysite.com</link>
        <description>The best site in the world!</description>
        <image>
            <url>http://mysite.com/mylogo.gif</url>
            <title>MySite.com Logo</title>
            <link>http://mysite.com</link>
            <width>100</width>
            <height>100</height>
        </image>

        <?php
        
while($story mysql_fetch_array($result))
        {
            
?>
            <item>
                <title><?php echo $story['title']; ?></title>
                <description><?php echo $story['desc']; ?></description>
                <link>http://mysite.com/read.php?id=<?php echo $story['storyid']; ?></link>
            </item>
            <?php
        
}
        
?>
    </channel>
</rss>

<?php

$rss_doc 
ob_get_clean();
ob_end_clean();

// Do what you want with $rss_doc. It would probably
// be a good idea to cache it so each call wouldn't need
// to generate a new doc each time.

// If you want to simply return the document, then you can
// get rid of the output buffering features

?>
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 01-15-2005, 04:53 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
thanks for that.

I'll let you know how i get a long.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 01-15-2005, 11:12 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
I kind of tried that but it was a bit confusing.

What i would like to do is pull out the x most recent articles from my articles table and makes syndicatable.

From what i have seen files of this type tend to end in rdf rss , so how is this done in php, or should i ask where does php fit into it.
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 01-15-2005, 11:42 AM
fambi's Avatar
Ultra Talker

Posts: 339
Trades: 0
Ok, i found THIS ARTICLE and followed it step-by-step (with the obvious db modifications) and now i get THIS.

Any ideas?
__________________

Please login or register to view this content. Registration is FREE
from a
Please login or register to view this content. Registration is FREE
is easy!
Read this
Please login or register to view this content. Registration is FREE
that uses our
Please login or register to view this content. Registration is FREE
.
fambi is offline
Reply With Quote
View Public Profile Visit fambi's homepage!
 
Old 01-15-2005, 12:11 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Any file with php in it must be saved as a .php file not a .xml file.

The extension of the file as far as xml or rss is concerned is unimportant compared to the structure of the document.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 01-18-2005, 03:09 PM RSS to HTML - RSS Creation
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by fambi
I am not being lazy, honest!, but recently i've been getting such good answers from you guys.

I am about to develop the news section of my website which i would like to make available via an RSS/XML feed.

Now i'd rather get it right from the beginning.

So, how do i make the RSS feed?
You can use FeedForAll http://www.feedforall.com it makes feed creation very easy. If you prefer to create the feed using a text editor there is a step by step tutorial for feed creation at http://www.make-rss-feeds.com

As far as displaying the feeds on your website, we have just released a free PHP script that will display the RSS feed as HTML details can be found at http://www.feedforall.com/free-php-script.htm

HTH
Sharon Housley
notepage is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Php - Xml - Rss
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34849 seconds with 12 queries