Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Readymade php script to generate rss feed from mysql?

3stripe3stripe ✭✭
edited March 2006 in Vanilla 1.0 Help
I've just added password protection to my WP site... so now the feed can't be viewed unless you're logged in... I still need to have a feed for one of the news categories however... So I'm thinking I should put together my own code to generate an RSS feed for it... anyone know of anything that would be pretty much good to go straight out of the box?

Comments

  • Options
    I think the best way would be to make a copy of rss2.php and modify it to suit your needs.
  • Options
    Problem is the plugin means anything in my wordpress directory is protect by the wp-login system... so I think the feed script has to sit outside it and not call any wordpress functions...
  • Options
    edited March 2006
    It's not really that hard.

    1. Query wp_posts for all posts in the news category (you're going to have to join with wp_post2cat for that). If you want to limit it by date, or by number of posts, that goes here too.

    example:
    SELECT * FROM wp_posts, wp_post2cat WHERE wp_posts.post_date > [insert cutoff date here] AND wp_posts.ID = wp_post2cat.post_id AND wp_post2cat.category_id = [insert category id number here] LIMIT [insert max number of posts here]
    (In real life, it's not a great idea to use a * in this query, but I don't really have time right now to figure out what specific columns you need)

    2. echo the header tags

    3. loop through your data, echoing an item element for each post

    4. echo the footer tags
This discussion has been closed.