Author Topic: rss feed?  (Read 2688 times)

0 Members and 1 Guest are viewing this topic.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
rss feed?
« on: October 17, 2011, 04:02:56 pm »
So I'm trying to make an rss feed, and my problem isn't with the formatting, or the php, or anything. I've got it at the point where the php outputs what should be proper rss xml, but I don't know how to get the browser to realize that it's an xml file, not html.
Code: (What you see) [Select]
http://domain.comdescriptionendomain.com/1.pngDesc1domain.com/1.pngDesc2
Code: (What you see when you hit view page source) [Select]
<?xml version="1.0" encoding="utf-8"?>
<rss version='2.0'><channel><title>Title</title><link>http://shakespearescomics.tk</link><description>description</description><language>en</language><item><title>Title1</title><link>domain.com/1</link><description>Desc1</description></item>...etc.

So the output of the php isn't wrong, but the browser can't detect that it's xml because the file is named 'rss.php.' I tried using Apache's .htaccess to treat xml as php but that doesn't work either... (AddType application/x-httpd-php .xml) I also tried adding 'Content-Type: application/xml' at the beginning of the file but that didn't seem to work either..

 

Offline Ikkerens

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 378
  • Rating: +28/-9
  • JavaScript Magician
    • View Profile
    • Walotech
Re: rss feed?
« Reply #1 on: October 17, 2011, 04:27:30 pm »
Code: (php) [Select]
<?php

header
(&#39;Content-Type: text/rss&#39;); //Or text/xml, either should be fine

?>


Splut for Android [----------]
Paused/halted indefinitely, might be abandoned, our graphic designer quit and the rest of us simply doesn't have the time to work on it...

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: rss feed?
« Reply #2 on: October 17, 2011, 05:01:45 pm »
If that doesn't work, you can use .htaccess to rewrite "rss.xml" into loading "rss.php."




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: rss feed?
« Reply #3 on: October 17, 2011, 05:38:40 pm »
Got 'em. Thanks guys.