Help - Search - Members - Calendar
Full Version: Putting RSS feed on non-MT Web page
Movable Type Community Forum > Additional Resources > Tips and Tricks
David Bill
I want to put the XML feed from athensmusic.com (a MT blog) onto another Web page, rockathens.com, which does not utilize MT -- it's just a standard Web page. Is this possible?

I found somewhere that if the xml was a .js, I could use some simple javascript to bring it in. But that's not the case.

Thanks,
David
trialanderror
If it's a link from one web site to another, without getting fancy, why not just hardcode the url to the xml feed. The .xml file is typically found in the same directory as your index.html (for entries). So maybe create an a href to the xml file.

CODE
<a href="http://www.sourcesite.com/Site URLfromWeblogConfig/index.xml


hope this helps, if its the content of the xml feed, I unable to help.

t&e
almuhajabah
There are several ways to show your latest blog entries on the other page.

If you can use PHP or SSI on the page, then create a new index template in your blog with a template something like this:

CODE
<MTEntries lastn="5">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a> (posted on <$MTEntryDate$>)<br>
</MTEntries>


Set a suitable output file for it (e.g., latestposts.htm). Then use a PHP or SSI include statement on the other page to pull in the file.

Whenever you add a new entry to your blog, the file will be rebuilt, and whenever somebody loads the other page, the server will grab the latest version of the file and insert it in the page.

You could also create the static page as an index template in your MT blog and just include the MT tags directly.

Either of these solutions would be more flexible than using your RSS feed.
DougSimpson
almuhajabah, that sounds very promising. I want to do the same as the original poster, but am pretty much helpless coding more than boldface.

Could you explain in a bit more detail (perhaps with a code example) what you meant by

"Set a suitable output file for it (e.g., latestposts.htm). Then use a PHP or SSI include statement on the other page to pull in the file."

(Ok, so I also know how to code italics)

Doug Simpson
Unintended Consequences
Blog on law, "small world" networks and insurance regulation
http://DougSimpson.com/blog
nammer
QUOTE (DougSimpson @ Aug 29 2003, 06:36 AM)
"Set a suitable output file for it (e.g., latestposts.htm). Then use a PHP or SSI include statement on the other page to pull in the file."

When you create your new index template, there's a field above the box where you place your template code called "Output File" - if you "set" the output file to "latestposts.htm", then when you save and rebuild that template, you'll see that new file at http://www.yoursite.com/latestposts.htm

Cool, no? wink.gif

Then, if you want that file to show in your destination page, and you can use PHP, you'd find the spot in your HTML on the destination page where you want the list to show up and insert what's called an include statement:
CODE
<? include '/path/to/your/latestposts/file.php' ?>
That's the server path to your file, which usually includes your username and "public_html" or "www" because the file is saved in your directory that's visible on the web.

Using PHP basically means changing the file extensions on your pages to .php Here's more information about that - if you don't want to do that for your destination site, you can use SSI if it's available, or there are some neat things you can do with something called an .htaccess file on your server to process files behind the scenes.

Does that help?

Donna
-lc-
Two other solutions (messy though) that come to mind is to put an IFRAME on the non-mt site and build a special mini page on the MT site to display over in the IFRAME.

Another idea is that there are javascript XML parsers out there and you could put one on the non-MT site.

PHP will be a cleaner solution if someone can find you a code snippet (and the server supports it).
DougSimpson
I've been able to create the stand-alone "latestposts.html" file ... but after that broke down.

To use PHP, do I need to change *all* my .html file suffixes to .php? Including all those in the blog directory Or just change the index.html file in my main (non-MT) page to index.php?
-lc-
Nope, you do not have to rename any files if you are on an apache server. You can tell it to process all your html files as php. Supposedly puts a little delay on the pages but darn if i can see it.

Simply find or create a file called .HTACCESS in your main web file area on your ftp, and add this line:

AddType application/x-httpd-php .php .php3 .phtml .html .htm

Then php code should work inside htm and html files

Then you can try this:
CODE
<?include("http://your.mt.server/latestposts.html");?>


If for some reason your server does not have PHP, you can do the same concept with SSI or if need be an iframe (not prefered for most visitors).
cedar
QUOTE
To use PHP, do I need to change *all* my .html file suffixes to .php? Including all those in the blog directory Or just change the index.html file in my main (non-MT) page to index.php?


The later, only the page with the PHP include needs to have the extension.

Depending on your server configuration even this may not be necessary, if your using Apache you may be able to do this via .htaccess by adding the line,

CODE
AddType application/x-httpd-php .php .html
This would go in public_html in a plain text file named .htaccess. Note that this file will be hidden by default so you may not see listed unless you create a filter (-a) in your FTP program of choice.

This has a slight advantage in that those who have index.html bookmarked will not recieve an error when trying to access a newly named index.php file.
cedar
Yeah, what -lc- said tongue.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.