1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need RSS help please!

Discussion in 'XML & RSS' started by heapseo, Nov 21, 2005.

  1. #1
    I want to add rss feds to a new website. I have added rss feeds before using yfs1's excellent script but my needs are a bit more complex now.

    Say a feed has 10 different articles, i want to be able to display a random number of those articles. (e.g. articles 2,5 and 6, or articles 6,8,11 etc). I dont even know if this is possible - if it is, could someone point me in teh direction of something/some code that can do it for me please.

    thanks.
     
    heapseo, Nov 21, 2005 IP
  2. briandunning

    briandunning Active Member

    Messages:
    262
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    98
    #2
    I don't know yfs1's script, but assuming it gives you the articles in a PHP array: you could generate another array of 3 or 4 random numbers out of ten, and then output your RSS something like this:

    while($myArray = $counter)
    {
    echo $rssArray[$counter];
    }

    You could also just shuffle($rssArray) and then only display the first 3.
     
    briandunning, Nov 21, 2005 IP
  3. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    heapseo, Nov 21, 2005 IP
  4. briandunning

    briandunning Active Member

    Messages:
    262
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    98
    #4
    You might also want to look at Magpie, since that supports caching of RSS content, to either disk or MySQL. This lets you access each RSS source only once every so often - set it for whatever interval you want to refresh your site content. Note that if you don't locally cache RSS content, some providers will shut off your access for abuse, like when G spiders you and you get slammed, thus slamming their RSS server.

    http://magpierss.sourceforge.net/

    The MySQL caching option is a hack that you'll have to look around for. I use it, it's great.
     
    briandunning, Nov 21, 2005 IP
  5. heapseo

    heapseo Peon

    Messages:
    636
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I actually downloaded magpie rss earlier but to be honest don't hve the faintest clue what to do with it. I can't find anything that says about uploading it to a webserver, where to put which files etc and it doesn't seem hte easiest thing to figure out when u dont have a clue what your doing!
     
    heapseo, Nov 21, 2005 IP