School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 340,098 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 4,837 people online right now. Registration is fast and FREE... Join Now!



Limit PHP XML Parser (RSS)

Limit PHP XML Parser (RSS) Rate Topic: -----

#1 pianoguy91  Icon User is offline

  • New D.I.C Head
  • Pip
  • Group: New Members
  • Posts: 3
  • Joined: 03-February 09


Dream Kudos: 0

Posted 04 March 2009 - 08:09 AM

I am relatively new to PHP and XML, and I am interested in being able to display the titles of blog posts in widget on a website I am building. I understand how to get all of the children and their values, but not to limit them to the most recent posts. Any help or reading suggestions?
Was This Post Helpful? 0
  • +
  • -


#2 JackOfAllTrades  Icon User is online

  • Mayor of Simpleton
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 7,127
  • Joined: 23-August 08


Dream Kudos: 50

Expert In: Being annoyed with lazy people.

Posted 04 March 2009 - 08:24 AM

Do you mean via RSS?
Was This Post Helpful? 0
  • +
  • -

#3 pianoguy91  Icon User is offline

  • New D.I.C Head
  • Pip
  • Group: New Members
  • Posts: 3
  • Joined: 03-February 09


Dream Kudos: 0

Posted 04 March 2009 - 08:27 AM

View PostJackOfAllTrades, on 4 Mar, 2009 - 08:24 AM, said:

Do you mean via RSS?


Yes. Similar to what wp_get_archives() function in Wordpress will accomplish.
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is online

  • Mayor of Simpleton
  • Icon
  • View blog
  • Group: Moderators
  • Posts: 7,127
  • Joined: 23-August 08


Dream Kudos: 50

Expert In: Being annoyed with lazy people.

Posted 04 March 2009 - 09:55 AM

I don't *think* RSS has any native, built-in way of supporting queries like get all since date. According to this, an RSS channel *may* have a lastBuildDate, which you could store and check your received data against.
Was This Post Helpful? 0
  • +
  • -

#5 AlienWebguy  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 84
  • Joined: 04-March 09


Dream Kudos: 0

Posted 04 March 2009 - 04:05 PM

Take into consideration that the XML feed is being controlled remotely and you pretty much only have to work with what they give you. That being said, you need to get the exact feed you want ahead of time (some sites let you provide feed parameters to filter out stuff you don't want or to order your feed a certain way before the data even gets to your server) or else you'll need to create a PHP script to pull the RSS feed, loop through it and insert it into a temporary database table, then use SQL to query your newly inserted data against some desired parameters and spit out exactly what you want shown. I wouldn't recommend the latter if you have a high-traffic site as you could generate some pretty significant cpu load. You could setup a cron job to pull the feed once every few minutes, or at longer intervals if the feed isn't updated very often and then only insert when you need to. You could also create a permanent table in your database called something like "cached_rss" and then check the realtime rss feed against your "cached" database-stored feed data and if there's a new feed entry, REPLACE, else just select what you have.

The idea here is that once the data is in mysql, you can pretty much do whatever you want with it.

--S--
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month