potatocake Posted June 17, 2008 Share Posted June 17, 2008 Hi, I have placed a create_rss.php file with the following code: <?php require('includes/application_top.php'); //$filename = DIR_FS_DOCUMENT_ROOT . FILENAME_RSS; //if (is_writable($filename)) { // open a file pointer to an RSS file $fp = fopen (DIR_FS_DOCUMENT_ROOT . FILENAME_RSS, "w"); // Now write the header information fwrite ($fp, "<?xml version='1.0' ?><rss version='2.0'><channel>”); fwrite ($fp, “<title>Your Title</title>"); fwrite ($fp, "<link>" . HTTP_SERVER . "</link>"); fwrite ($fp, "<description>Your description</description>"); fwrite ($fp, "<language>en-us</language>"); fwrite ($fp, "<docs>" . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_RSS . "</docs>"); $news_query_raw = tep_db_query("select * from " . TABLE_NEWS . " order by id desc limit 10"); while ($content_rec = tep_db_fetch_array($news_query_raw)) { fwrite ($fp, "<item>"); $headline = $content_rec['name']; $date = 'Date: ' . tep_date_short($content_rec['date_created']); $content_1 = substr($content_rec['content'], 0, 250); $content = strip_tags($content_1); if (strlen($content_rec['content']) > 250) { $content = $content . "...."; } fwrite ($fp, "<title>$headline</title>"); fwrite ($fp, "<pubDate>$date</pubDate>"); fwrite ($fp, "<description>$content</description>"); $item_link = HTTP_SERVER . DIR_WS_CATALOG . FILENAME_NEWS . "?article=" . $content_rec['id']; fwrite ($fp, "<link>$item_link</link>"); fwrite ($fp, "</item>"); } fwrite ($fp, "</channel></rss>"); fclose ($fp); tep_redirect(tep_href_link(FILENAME_NEWS, 'update=true')); // } else { // tep_redirect(tep_href_link(FILENAME_NEWS, 'update=false')); // } ?> in the location of catalog/admin I tried running this file and setting its chmod permissions to 777 but im getting these errors Warning: fopen(/public_html/rss.php) [function.fopen]: failed to open stream: Permission denied in /public_html/admin/create_rss.php on line 8 Warning: fwrite(): supplied argument is not a valid stream resource in /public_html/admin/create_rss.php on line 13 Warning: fwrite(): supplied argument is not a valid stream resource in /public_html/admin/create_rss.php on line 15 Warning: fwrite(): supplied argument is not a valid stream resource in /public_html/admin/create_rss.php on line 17 Warning: fwrite(): supplied argument is not a valid stream resource in /public_html/admin/create_rss.php on line 19 Warning: fwrite(): supplied argument is not a valid stream resource in /public_html/admin/create_rss.php on line 21 Could i get some help as to how this is done properly. I havent been able to find a post with the full instructions on how to do this. Thanks heaps Quote Link to comment Share on other sites More sharing options...
potatocake Posted June 18, 2008 Author Share Posted June 18, 2008 I figured out that it was the permissions and have fixed the errors coming in but still no rss.xml file could someone please shed some light on the situation. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.