• I would like to have a list of 5 resent articles have posted on my blog (Running WP Strayhorn). The catch is, I would like to display this list on another website of mine that is NOT running WP. How would I go about doing this? The onley solution I have found so far is using an RSS agragator and cornjobs. There must be a better way of doing this.

    Please Help,
    Cron

Viewing 15 replies - 1 through 15 (of 17 total)
  • either you fetch the data directly in the DB and process it locally, or you fetch the preprocessed data that WP returns. WP happens to return the preprocessed data in XML (rss, atom, rdf, as you see require). there is no better way to do what you want to do than with rss.

    Thread Starter cron

    (@cron)

    Ok, thanks. I thought there must be some other way but I was wrong.

    Cron

    If you can access the database directly from the other site, I recommend that method over pulling the RSS feed.

    On one of my sites, I was originally grabbing the RSS for a bunch of blogs and processing them to find out when their most recent posts were. The problem is that it was really slow – with 13 blogs, the page was taking 10 seconds to load. When I rewrote it to just query the databases directly, it only takes about 1 second. And there’s a lot less load on the server.

    I would resent displaying recent posts that I resent. — Could not resist…

    Thread Starter cron

    (@cron)

    RustIndy. Can you share the code you wrote please? By the way, it is still on the same server (same localhost) however it is just a subdomain not running wordpress………….

    Well the code I wrote doesn’t do what you want it to – all mine does is find out what the date of the most recent update to a blog was. Hell, I just realized it doesn’t even respect the published flag ?? I should fix that….

    Plus it’s written in ASP, not PHP. Dunno if you’re on a Windows server or not, but it’ll only work under IIS, not Apache.

    All I really did was create a new user in the database with only the SELECT right (read-only, essentially) on the WP databases. Then the ASP code just queries each database for the first record of the wp_posts table after sorting by post date. When it gets all the dates from 16 blogs into an array, it sorts the array and displays the info on my page.

    A similar setup should work for you ?? You’ll probably want to dig into the WP code though to find out exactly how to structure the query so it respects the publish flag and whatnot though.

    Thread Starter cron

    (@cron)

    Ok. I dont think I can do that because I am new to wordpress and have never used PHP before. Still, I can try…………….

    Ive used https://soderlind.no/archives/2004/11/08/aggrss-an-rss-aggregator/ to display posts from another site on mine via RSS

    Thread Starter cron

    (@cron)

    That is a wordpress plugin. I would like to have this on a NON-WORDPRESS site. To show things I have resently updated on my WORDPRESS site. Sorry about the confusion.

    Using an aggregator is the ‘proper’ way to bring headlines in from a secondary site, so long as you can use the method defined by the aggregator.

    CG-Feedread is a good tool aggregate your site posts. It can grab the RSS feed from your WP site, and display it in any PHP website page. Has no WP dependency. You can drop the CG-PowerPack files on another PHP box that doesn’t have WP even, and direct-include cg-feedread.php at the top of the PHP file you want to show feeds on. (Almost all of my ‘plugin’ files are just ‘stubs’ that include the real code — so most you can do yourself, and use on non-WP sites…)

    -d

    rust: did you forget to cache or something? ??

    I’m experimenting a site who is aggregating over 50 sources with no lag: the trick is to use the cache and to update the feeds at shutdown.

    denis: i wasn’t caching originally, nope. now there’s a cron job on my server that runs every 5 minutes and pulls the info directly from the WP databases to store the necessities in another database. Realistically, I could just read all the databases whenever the page is read (it only takes about a second to get the info from 20 blogs), but this way seriously reduces the load on the server ?? And it’s a hell of a lot easier to work with the database data than the XML data ??

    Thread Starter cron

    (@cron)

    How could I use somthing like the resent posts plugin for my other site if I know the database info?

    David: I will look into your option, I have use some of your files before and they are usually good code…..

    I wouldn’t ever depend on two separate servers being able to establish a database connection — not with hosting companies locking down sockets to their DB servers to internal hosts only (which, unfortunately, means nice GUI sql apps are useless…).

    If you have two sites on the same host, and can directly access the database, easy enough to write your own function to grab and display entries.

    But, since RSS feeds do all the work for you, abstract away what the source is so you don’t hardcode anything other than a URI… that would seem to me the safest, long term option. ??

    -d

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Displaying Resent Blog Posts on a Diffrent Site’ is closed to new replies.