Topic: Pulling info from database to fill in an RSS feed - working but I have a ? (Read 514 times)
My Name is Enigo Montoya
Posts: 33
188 credits Members referred : 0
« on: Sep 11, 2007, 03:44:20 AM »
I am using a CMS system that stores data in MySQL, and I wanted to be able to fill in the RSS feed with the CMS pages. I created rss.php which pulls the info from the database, sets some vars, and outputs the XML template...the problem is getting all the pages from the CMS system to display in the rss feed. (Currently only the Home page is displaying which is the first row in my table)
I got the idea from a blog script where it does just that...gathers all the blog postings(also stored in a database) and fills the XML template for the feed. Looking into it further I found code that creates the multiple entries into the feed, but it was full of global vars and references to other functions thoughout the script. Does anyone know of an easier way of doing this?
Code:
<?php // rss.php /////////////////// connect to the database /////////////////////////////////////////////////////////
require_once('include/DbConnector.php'); require_once ('include/Validator.php'); new DbConnector();
My Name is Enigo Montoya
Posts: 33
188 credits Members referred : 0
« Reply #2 on: Sep 12, 2007, 04:17:09 AM »
Thank you for the reply, and suggestions Olaf. Before I posted this I found some info on "while" loops here http://www.phpeasystep.com/mysql/6.html but I must have had some things out of place. I moved some things around, and now am able to pull all the table results to display them in HTML. I used the same format to extract the data, and by using the following I can build my links to the pages
So step one is down (pulling ALL the info from the database...now just parsing it into XML format). I read today until my head hurt I found some parsers that use "pear" which I know nothing about...and when I got home I went back to try the code from the blog script but it didn't work...all I got was
XML Parsing Error: no element found Location: http://www.sitename.com/test.php/ Line Number 1, Column 1: ^ which is my opening <?php tag
So I searched again and found this http://agave.garden.org/~aaronh/php/txt2rss.html but it takes the info from multiple text files that are uploaded and not a database so this doesn't serve my purpose of having the database update the XML file. I also downloaded a class from phpclasses and then I notices posting of how others couldn't get it to work either. I am farther along than I was, but now I am not having any luck...any ideas?
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6343
38878 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Sep 12, 2007, 08:43:02 AM »
you can use some project too, but you problem is more basic.
you should continue with the code that show your whole record set in the html
you can use some project too, but you problem is more basic.
you should continue with the code that show your whole record set in the html
Nah that code was crap, and wouldn't have done anything. I admit that I can't sit down and just right code in depth code full of fuctions from scratch, but if I have some in front of me as a start, I can normally spot patterns and piece things together. Some are designers and some are programmers...and most of the time we can tell when a site has been designed by a programmer. With programming phone lines in a switch all day, and going on very little sleep...I have resolved this issue. XML works
At least I wasn't asking about MS Access, and how I could store my co-workers names and what department they work in...LOL
Thanks
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6343
38878 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Sep 12, 2007, 11:10:54 AM »
come on... what you're trying is a beginners job, but it's up to you to learn somthing
My Name is Enigo Montoya
Posts: 33
188 credits Members referred : 0
« Reply #6 on: Sep 12, 2007, 11:29:02 AM »
How to echo hello world is a little more beginner than this. Yeah, some are here to learn and some are here to teach. I won't post code because you probably already had 5 versions on how to do it. That is the only way anyone can learn is by being persistant about what they want to do. As always, I appreciate your ideas...it steps the thought process up a level.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7092