RSS CREATOR for Your Site

Started on the old forum in December 2009 · view the original in the archive · old links redirect here

No replies · 515 views · started 16 years ago · 1 min read

blackhowk Senior · 411 posts #1
<?php // rss creator // what its rss? /* **RSS (most commonly expanded as "Really Simple Syndication") is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format. An RSS document (which is called a "feed", "web feed",or "channel") includes full or summarized text, plus metadata such as publishing dates and authorship.** */ // first time must process data from forum - pick a forum,guestbook // the second time you have to do to connect to database // the third time you have to set variables from the request in writing .xls // define filename name $filename = 'index.xml'; // define TTL $ttl = '5'; // define year $year = date("Y"); // correct date RFC - Wed, 02 Oct 2002 15:00:00 +0200 $publish = date(DATE_RFC822); // connect to database HERE! // *make connection dude!* // select from database // as i know you must select the table of your forum // for lava use something like this - i dnno // SELECT `id`,`name`,`text` FROM `ibwf_topics` ORDER BY `id` DESC $srss = "SELECT `id`,`name`,`text` FROM `ibwf_topics` ORDER BY `id` DESC"; $result = mysql_query($srss); // rss header + style // write xls $somecontent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <?xml-stylesheet href=\"rssfeed.xls\" type=\"text/xsl\"?>
<rss version=\"2.0\">
<channel>
        <title>ngeo Social Mobile Network - DEFINE THE TITLE HERE</title>
        <link>DEFINE THE SITE NAME HERE</link>
        <description>DEFINE THE DESCRIPTION HERE</description>
        <copyright>Copyright $year, ngeo mobile social network articles</copyright>    
        <generator>DEFINE THE GENERATOR - SITENAME</generator>
        <ttl>$ttl</ttl>
        <pubDate>$publish</pubDate>

\n\n"; 

// select from database
// for lava use something like this - i dnno while(list($id,$n,$t) = mysql_fetch_array($result))

{

// put the content correct // for lava use $t $clean_name_S = ereg_replace("[^a-z0-9._]", "-",

                         str_replace(" ", "-",

                           str_replace(".", "-",

                             strtolower($t) ) ) );

// put the content correct

// for lava set the correct link and correct values in the correct places $id,$n,$t // set your link // the link must return the correct values and must you bring back $somecontent .= "<item> <title><![CDATA[$t]]></title> <link>http://ngeo.ro/index.php?type=forums&mobile=read&forum=$t&$clean_name_S</link> <description><![CDATA[$t]]></description> <category>$n</category> <pubDate>$publish</pubDate> </item>\n"; }
// close rss $somecontent .= "</channel> </rss>"; // make the file, if it exists it will overwrite it $fp = fopen($filename,"w") or die ("error opening file .xml"); // set the content into the file fputs($fp,$somecontent); // close the file fclose($fp);

echo "rss created at $publish!";

// validate your feed to W3C Feed Validation Service, for Atom and RSS ?> you can password protect the page and periodically run. expect questions here and demo :) the upload contain the css aka xsl.

Attachments: rssfeed.zip

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close