Add a .PHP RSS Feed into a .HTM pg with .HTACCESS

Discussion in 'Apache' started by eschumann, Mar 29, 2006.

  1. #1
    Hello all, I am stumped :confused: I have a .htm page that I am wanting to include a .php script which contains a RSS feed. I want to keep the .htm file extension because all of my pages are already indexed, changing the file extension to .php is not a option.

    I have the code for the php file for the RSS feed. It 100% works.

    I am using the code for my .htaccess file which I am 99% sure is right but I have never gotten it to work:

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

    OK, the .htm pg I am getting this error when I include the .php script:

    %s", trim($link),htmlspecialchars(trim($title))); printf("
    %s

    ",htmlspecialchars(trim($description))); $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; } } } $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterData"); $fp = fopen("http://news.search.yahoo.com/news/rss?p=Houston+Astros+&ei=UTF-8&fl=0&x=wrt","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); ?>

    When I change the file extension from .htm to .php the RSS feeds shows up and works properly.

    I emailed my host and they said my server has access to run this and it should work. Here is my server specs:

    http://www.halfpricehosting.com/web-hosting.aspx

    Any ideas guys? I really am banging my head against the wall on this one. The .htaccess file is in my root as I type, I even tried to put it in the folder with the file(s) I want to use the RSS feed on just for giggles. Did not work, was told it should be in root.

    Big major ups to anyone that can help me solve this one.
     
    eschumann, Mar 29, 2006 IP
  2. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #2
    This

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

    need to go on your virtual host configuration file ... and you need to reload the apache.

    I have a lot of php pages with html extension.

    Regards
    Adrian
     
    sacx13, Mar 29, 2006 IP
  3. RectangleMan

    RectangleMan Notable Member

    Messages:
    2,825
    Likes Received:
    132
    Best Answers:
    0
    Trophy Points:
    210
    #3
    Why not use javascript for the feed insertion?

    I did it last night at democracyforums.com

    Look over at dynamic drive for a few good ones...a couple even cache!
     
    RectangleMan, Mar 30, 2006 IP
  4. carowan

    carowan Peon

    Messages:
    473
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #4
    give magpie a shot. I had it up an running in 20 minutes. offers a cache also.

    magpierss.sourceforge.net
     
    carowan, Apr 4, 2006 IP