A simple way to do RSS Feeds?

Discussion in 'XML & RSS' started by jackburton2006, Nov 18, 2005.

  1. #1
    Hope you guys can help me with this:

    I have a main site, but also a blog. I'd like to RSS feed the latest entries from my blog to my pages as a sidebar-like addition. Currently I'm using this site (http***itde.vccs.edu/rss2js/build.php) to do the feed. It's pretty simple. I just plug in my blog address and insert their javascript code and voila, the blog entries show up.

    But it's not perfect. For instance, if I use hypens or anything out of the ordinary, the feed shows up with question marks in them. Also, it's not very customizable. I can't get it to show up the way I'd like it to.

    Can anyone recommend another method to do this? A simpler, more customizable method? For instance, I really like the way My!Yahoo does the RSS feed. Simple, sleek, and looks nice.

    Thanks.
     
    jackburton2006, Nov 18, 2005 IP
  2. dj1471

    dj1471 Well-Known Member

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #2
    Where is the blog hosted? If it's running on the same server as your site it should be relatively straightforward to code something up in PHP to extract the details from the database.

    If the blog is hosted elsewhere so you are forced to use the RSS feed, you'll need to either code something to parse the RSS feed and display the details (not terribly complicated once you understand what's going on) or find another tool on the web to do it (I should imagine there are plenty, as lots of people are doing it). If you might want to code something yourself, you may wish to follow this thread.
     
    dj1471, Nov 18, 2005 IP
  3. jackburton2006

    jackburton2006 Peon

    Messages:
    5,296
    Likes Received:
    282
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah the blog is hosted on the same server as my main site. I'm using Wordpress, and I was thinking about asking the Wordpress guys for help. Can you point me to a software/some place for hints on how to do this myself?
     
    jackburton2006, Nov 18, 2005 IP
  4. vulcano

    vulcano Active Member

    Messages:
    418
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    68
    #4
    as I am I newbee myself, I had a hard time to figure out the correct settings to get the rss feed going on wordpress.
    The final solution, you have to alter the sidebar.php of the theme you are using (e.g. with wordpad just sinple copy/paste). Currently I am using feedburner, works nice for me.
     
    vulcano, Nov 19, 2005 IP
  5. dj1471

    dj1471 Well-Known Member

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    116
    #5
    I've done this on my website with a Wordpress blog. Is your main site in HTML or PHP?
    You'll need a reasonably-simple bit of PHP code to query your blog's database, then you've got full flexibility over how the data is displayed. Something like this:

    
    $sql = "SELECT post_title, id FROM wp_posts WHERE post_status=\"publish\" ORDER BY post_date DESC LIMIT 5;";
    $result = mysql_query($sql, $conn) or die ("Could not execute blog entries query!");
    
    $x = 1;
    while($row = @mysql_fetch_array($result)) {
            $posttitle[$x] = stripslashes($row[0]);
            $postid[$x] = $row[1];
            $x++;
    }
    
    echo "Latest Blog Entries";
    echo "<br />\n";
    for ($x = 1; $x <= 5; $x++) {
            if (isset($posttitle[$x]))
                    echo "<a href=\"/blog/?p=".$postid[$x]."\">".$posttitle[$x]."</a><br />\n";
    }
    
    PHP:
    That would get the titles of the most recent five posts and display them with links to the posts. You may need to modify it a bit to format it how you want and make sure the links point to where your blog is.
    If you need help making sense of it, I suggest you ask in the PHP forum as they'll be more people who can help you there.
     
    dj1471, Nov 19, 2005 IP
  6. Bobafart

    Bobafart Peon

    Messages:
    56
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    dj1471 has a good way of simply posting links with the code he posted above

    if you google php tutorials there will be tonnes of sites that take you through basic tutorials to expplain the code dj1471 posted

    devshed . com is a good site for instance
     
    Bobafart, Nov 21, 2005 IP