This topic is locked

Creating RSS Feed

2/4/2012 8:47:44 AM
PHPRunner General questions
A
ant author

I made a post about 2 weeks ago but it doesn't seem to be on the General discussions and I'm not sure if it was deleted.
I need help creating a RSS feed from my database so that it highlights all new items from a ToDo table that I created to remind people to complete certain tasks. I found a topic in this forum http://www.asprunner.com/forums/topic/15866-how-to-subscribe-to-database-changes-via-rss/ but am having difficulty following what I have todo.
The post says, "This is the first article of two-part series explores the basic RSS subscription to database changes. Second article covers signing for data updates matching specific SQL queries." but I only see the one topic so Im not sure if they refering to the topic or another post made subsequently.
Please can someone help me with how to edit the rss.php file or how to set up the RSS feed.
Thanks

C
cgphp 2/4/2012
A
ant author 2/4/2012

Thanks Cristian for the response

I'm not sure what I must edit in the file, I think I need to change the following;

// table name

if (!$_REQUEST["table"])

exit();
// set feed parameters

$myfeed = new RSSFeed();

$myfeed->SetChannel('http://www.yourwebsite.com/';,

'Yourwebsite.com, Table '.$tablename.' RSS Feed',

'feed description',

'en-us',

'Copyright (c) 2010 www.yourwebsite.com';);

A
ant author 2/4/2012

I've managed to add a email forward in php runner to the todo item which also serves the purpose of notifying me but I would like to add a conditional statement to the forward that looks up the consultantID and sends the email to that consultants email address.
I'll appreciate if someone can help me with the syntax, I also would like to send the email without the php tags to make it easier to read.
I tried the following conditional statement but I get syntax errors, I also need to check more than one consultant todo items and forward same;
global $conn;

$strSQLExists = "select
from todo where 'consultant_ID' = '3'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

if($data)

{

$email="mail@ronel.com";

$from="admin@test.com";

$msg="";

$subject="New ToDo item - Ronel";
foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$msg.= $field." : ".$value."\r\n";

}
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
}

else

{

$email="admin@test2.com";

$from="admin@test.com";

$msg="";

$subject="New ToDo item";
foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$msg.= $field." : ".$value."\r\n";

}
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
}*

C
cgphp 2/4/2012

As article said, you may want to customize the RSS metadata:

$myfeed->SetChannel('http://www.yourwebsite.com/';,

'Yourwebsite.com, Table '.$tablename.' RSS Feed',

'feed description',

'en-us',

'Copyright (c) 2010 www.yourwebsite.com';);
A
ant author 2/4/2012

Is this correct;
$myfeed = new RSSFeed();

$myfeed->SetChannel('http://time.za.net/todo_list.php''>http://time.za.net/todo_list.php',

'http://time.za.net, Table '.$tablename.' RSS Feed',

'ToDo items',

'en-us',

'Copyright (c) 2010 http://time.za.net');