Feed Maker


Posted on 16th Feb 2014 07:03 pm by admin

Hi all.
First of all I must say I am not a php developer so I am afraid I don't know much about it.

I am using the bloging software on my site called Super Simple Blog. This software includes a file called feed_maker.php which I have posted below:

<?php
/********************************************

feed_maker.php

This class is used for generating an RSS
feed.

********************************************/

class GenerateFeed{

var $TABLENAME;
var $websiteRoot;
var $pageTitle;
var $rssDesc;
var $rssLink;
var $rssFileName;
var $blogPageName;

function makeFeed($table, $webroot, $title, $desc, $link, $rssfile){

$this->TABLENAME = $table;
$this->websiteRoot = $webroot;
$this->pageTitle = $title;
$this->rssDesc = $desc;
$this->rssLink = $link;
$this->rssFileName = $rssfile;

//empty array which will be pushed all of the
//possible images for the home page.
//These are displayed when the page loads.
$spl = array();

// Query the database.
$query = "SELECT * FROM $this->TABLENAME ORDER BY uid DESC";
$result = mysql_query ($query);

//init a counter
$i = 0;

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

$spl[$i] = $row;
$i++;

$ima = split(", ", $row['image']); //build array out of images list
$com = nl2br($row['comment']);

//if there is more than 1 image per entry
for($h=0; $h<count($ima); $h++){
$j = $h+1;
if($imagesPerEntry != 1){
if(substr($ima[$h],-4) != '.pdf'){ //filter out PDFs
$com = str_replace("[$j]", "<img src="$this->websiteRoot/blogImages/$ima[$h]" />", $com);
}
}

if($imagesPerEntry == 1){
if(!empty($ima[$h])) {
if(substr($ima[$h],-4) != '.pdf'){ //filter out PDFs
$com = str_replace("[$j]", "<img src="$this->websiteRoot/blogImages/$ima[$h]" />", $com);
}
}
}
}
//output the database
//each row will be 1 item
$addBlock .= "nn<item>
n
<title>{$row['title']}</title>
n
<link>$this->rssLink?entry={$row['uid']}</link>
n
<description><![CDATA[$com]]></description>
n
</item>nn";
}


// Write the three blocks to file
//this is the file that we are writing
$fileT = $this->rssFileName;
$fileT = fopen($fileT, "w");

//start off every feed with this
$startBlock = <<<EOR
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>$this->pageTitle</title>
<description>$this->rssDesc</description>
<link>$this->rssLink</link>
EOR;

//end every feed with this
$endBlock = "</channel>nn</rss>";


fwrite($fileT, $startBlock);

fwrite($fileT, $addBlock);

fwrite($fileT, $endBlock);

fclose($fileT);



//end of method
}
//end of class
}

?>


This file creates an rss feed from my blog.
My question is; would it be possible to add some code to this file which would give each item in the feed its own time and date stamp, for example;
Code: <pubDate>Fri, 15 Jan 2010 12:00:00 +0000</pubDate>

I can't find any support for this feed_maker.php file so that is why I have come here.

Thanks in advance

No comments posted yet

Your Answer:

Login to answer
110 Like 49 Dislike
Previous forums Next forums
Other forums

Confusing Functions
So, I've been reading up on Functions and I like them! However, I need some help using variables in

using a loop help
Hi guys , i need some help. I have this loop :
while ($row = mysql_fetch_assoc($Result)) { ?&

SWF image using php?
Hello once again.

My latest en devour requires me to produce an image of a static .swf that i

Captcha problem users just refresh and it will let them auto submit again
Users will just re submit and not have to enter the new captcha.. ? Lol but if i refresh the page, t

At max how many columns is advisable to create in a table/view
Hi All,
I have two transaction table from which i want to create a simple view or material

How can i steam a video on my PHP site? (non YouTube)
Basically I have a PHP site and don't want to give page rank to YouTube. I just want to stream a bas

pls clear my confusion
Hi friends,

Pls solve my query .

what is the exact use of Scope Resolution Operator( i

Character Sets/Collations Stuff
Can someone please give me a check list of things I must do to setup all the charset stuff for my ph

timed header image rotation
I have a joomla site and I was trying to setup a rotating image based on timing NOT just refreshing

Load Animated Image while cache is serve
I have a page that loads up using cache and took about 1 to 2 minutes before it loads to the page. <

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash