eschumann
Mar 29th 2006, 1:24 pm
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 this 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.
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.
I have the code for the php file for the RSS feed. It 100% works.
I am using this 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.
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.