[RESOLVED] Finish making this re-usable! (VisualAD!???)
VisualAD was helping me with this, but i havent seen him on MSN!
anyway.. I am trying to make this code re-usable. Its an RSS Feed parser to be used on my forum. Right now I need 1 file for each feed, so im using basically 11 files, renaming the function names in each one and passing 1 feed url into each file. the result looks like this: http://staticfx.com/forums/bb3portal.php (rss gaming news section)
now I would like to reuse the code and just loop thru the feed urls..
one thing to keep in mind, this section of code: (PHP 5.1.4 - Just updated.. was running 4.3.11)
the 'oneup' variable needs to change with each feed url, because the output is dont in an html file by each variable.. so in this case the output file would use {oneup.LINK} etc...
so when passing in a url, i need to pass in a url & the output variable... or, if there is another way around it
Attached:
Original file: rss_1up.php
Partially completed new file: rss_feeds.php
Output HTML file: rss_feeds.html
Last edited by Static; Apr 18th, 2007 at 09:37 AM.
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Now that you've upgraded to PHP 5, you can make use of its improved class syntax. 'var' can be replaced with 'private' and the constructor name with '__construct' - which saves you having to rename it if you decide to change the class name.
It looks to me as though you merely need to write the constructor, which entails simply assigning the private variables. I would pass the URL in to the constructor as well, rather than the runfeed() method. (You can also make that private, by the way.)
You'll need to change these two lines to point to the member functions: