• 0

[PHP] XML Parsing Script


Question

For anyone that might have experienced this problem before, I'm trying to import my Wordpress feed into a website using a PHP XML parsing script... well that is the intention. I've Googled to try and find something that is relevant to my interests but to no avail, most of the scripts I've found don't particularly deliver what I need. I was hoping for something that pulls in the title of the latest post, the featured image and x amount of characters from the start of the post, all of it posted in html with customisable tags.

I'm not the most skilled PHP programmer (still learning), and I've spent hours trying to get it to work so this is a last resort really. Any help would be greatly appreciated.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

I've tried the beginners script, it worked but not to the full functionality that I needed, got stuck with the intermediate one. It just wouldn't open my feed at all! I downloaded the feed saved it as xml_intermediate.xml it just output the html at the end of the script.

Link to comment
Share on other sites

  • 0

for anyone that is interested I ended up solving this using this persons contribution http://www.corvidwor...-on-other-pages

really clever and simple, I recommend it if anyone finds themselves needing this kind of solution


		  <?php
		  // Include WordPress
		  define('WP_USE_THEMES', false);
		  require('../blog/wp-load.php');
		  query_posts('showposts=1');
		  ?>
		  <?php while (have_posts()): the_post(); ?>

		  <?php endwhile; ?>
		  <?php while (have_posts()): the_post(); ?>
		  <h2><?php the_title(); ?></h2>
		  <?php the_excerpt(); ?>
		  <p><a href="<?php the_permalink(); ?>">Read more...</a></p>
		  <img src="<?php featured_image(); ?>">
		  <?php endwhile; ?>

Link to comment
Share on other sites

This topic is now closed to further replies.