Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Insert RSS Feed Into Page

Featured Replies

Ok I've tried at least 3 different bits of javascript which all work, but go through external sites and as such are both slow and unreliable. I haven't slept in 48 hours, would really appreciate some help!

  • Author

yep - but i put in my feedburner url (+standard feed url) and it just came up with 'no links found' :(

If you are using PHP you can use the function SimpleXMLElement to read from XML files (RSS is XML of course.) then display them in any format you want.

I seem to remember having problems pointing to the blog url when I set up Google Feed.

Are you sure the url is correct? I'm sure it is but you never know.

  • Author

yeah I triple checked it, even loaded it in a browser first then copied out the url - this is a nightmare! lol

The following code is something I got from somewhere but no longer know where.

If anyone knows where it came from I will happily add credit to the author.

 

It's php though so requires your pages to be .php's

 

Include xml_parse.php in your head, and include feeds.php wherever you want the feed to appear.

 

xml_parse.php

<?php

$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";

function xml_reset(){
global $insideitem, $tag, $title, $description, $link;
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";

}

function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
	$tag = $name;
} elseif ($name == "ITEM") {
	$insideitem = true;
}
}

function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link;
if ($name == "ITEM") {
	printf("<li class=\"menu\"><a href='%s' alt='%s' title='%s'>%s</a></li>",
	trim($link),htmlspecialchars(trim($description)),
	htmlspecialchars(trim($description)),
	htmlspecialchars(trim($title)));
		$title = "";
	$description = "";
	$link = "";
	$insideitem = false;
}
}

function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link;
if ($insideitem) {
switch ($tag) {
	case "TITLE":
	$title .= $data;
	break;
	case "DESCRIPTION":
	$description .= $data;

	break;
	case "LINK":
	$link .= $data;
	break;
}
}
}
?>

 

feeds.php (example with sitepoint)

<a name="SitePoint"></a>
<ul><b><a href="http://www.sitepoint.com">Site Point</a></b>
<?
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("http://www.sitepoint.com/rss.php","r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
	or die(sprintf("XML error: %s at line %d", 
		xml_error_string(xml_get_error_code($xml_parser)), 
		xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
xml_reset();
?>
</ul>

The following code is something I got from somewhere but no longer know where.

If anyone knows where it came from I will happily add credit to the author.

 

It's from the Sitepoint article on parsing RSS 1.0.

 

I highly recommend the SimpleXML functionality in PHP if you can get your head around it, it makes things a lot easier. There is a good tutorial on reading RSS using SimpleXML here. I have to admit I haven't used it, but a quick browse shows it covers most of the bases.

  • Author

Thank you both of you! I will give both your suggestions a try and let you know how I get on :)

  • Author

Ok Eris, got your one working - only two things I can't figure out how to do.

 

1. Limit the number of items to display to just one

2. Stop it from displaying all my apostophes as code ?

I use Carp Evolution as my RSS to HTML script of choice - http://www.geckotribe.com/rss/carp/ - you can do anything you want witha feed. $50, ignore the shocking, salesy web design, it really is a great piece of software that you can install on your own server, also has a good support forum.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.