hchsk Posted May 2, 2009 Share Posted May 2, 2009 i have a dynamic rss page generated with php, but for some reason, when i attempt to include the $nowpub as <pubDate> , even though looking at the generated source, the pubDate is properly written, the date does not display! still oddly enough, when i've tried to troubleshoot by replacing the generated <pubDate> with an identical, but hand typed <pubDate>, it displays correctly! thank you for any ideas and help! <?php //CHECK WHEN LAST MODIFIED AND ASSIGN TO VAR $lastmod = date("mdHis", (filemtime("report.txt"))); $lastmod += 10000; //GET CURRENT DATE $now = date("mdHis"); $nowpub = date("D, j M y g:i:s"); //GET LAST UPDATE $lastupdate = date("mdGis", (filemtime("modifycheck.txt"))); //////instead of storing value here, change file and get date("mdGis", (filemtime("modifycheck.txt"))); //GET SCORES $filename = "scorestore.txt"; $score = file($filename); //GET COMMENT $filename = "comments.txt"; $comment = file($filename); $luck = rand(0, 34); //GET REPORT $filename = "report.txt"; $report = file($filename); echo <<<END <rss version="2.0"> <channel> <title>HCHSLive Network Feed</title> <link>http://www.lowersouthlounge.com</link> <pubDate>Wed, 29 Apr 2009 08:10:00 EST</pubDate> <description>HCHS Live Network</description> <language>en-us</language> <lastBuildDate>Wed, 29 Apr 2009 08:10:00 EST</lastBuildDate> <managingEditor>[email protected]</managingEditor> <webMaster>[email protected]</webMaster> <image> <title>HCHSLive Network Feed</title> <url>http://www.lowersouthlounge.com/favicon.ico</url> <link>http://lowersouthlounge.com</link> <width>16</width> <height>16</height> </image> END; //SAVE OLDFEED AS $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'r'); $originalfeed = fread($fh, filesize($myFile)); fclose($fh); //CHECK IF NEW INFO if ($lastmod >= $lastupdate){ /////////////////////////////////////////THIS MUST LOOP FOR REPORT.TXT ARRAY - MULTIPLE REPORTS IN ONE LOAD //CREATE NEW ITEM for ( $counter = 0; $counter < count($report); $counter += 1 ) { //MAKE CATEGORY for ( $counter2 = 1; $counter2 <= 10; $counter2 += 1 ) { //////////////////////////////////////////////////////////////////CHANGE FUNCTION TO CHECK FOR TEAM NAMES $hold = 'team' . $counter2 . ' '; //SPACE CHECKS FOR ERRORS DUE TO DIGIT REPEAT AT 10+ if (stristr($report[$counter], $hold) != false) {$category = $category . trim($hold) . '/';} } $newfeed = $newfeed . " <item> <title>HCHSLive Network Update</title> <category>$category</category> <link>http://lowersouthlounge.com/circle.php</link> <description>$report[$counter] $comment[$luck]</description> <pubDate>$nowpub EST</pubDate> </item> "; } //OVERWRITE FILE, FIRST NEW ITEM THEN $originalfeed $myFile = "addfeed.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, " $newfeed $originalfeed "); fclose($fh); //EMPTY REPORT.TXT $myFile = "report.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, ""); fclose($fh); //CHANGE modifycheck.txt $myFile = "modifycheck.txt"; $fh = fopen($myFile, 'w'); fwrite($fh, "$now"); fclose($fh); } //CHECK FOR INACTIVITY ///////////////////////////////////////////////////////////////// FINISH ME! /////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////IF NECESSARY, SAVE TEAM UPDATE TIMES TO FILE ///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //if ( $now -= (loop through teams).lastupdate <= 240000) {$warning = $team . 'is in danger of inactivity! Less than 24 hours left!';} //if ( $now -= (loop through teams).lastupdate <= 120000) {$warning = $team . 'is in danger of inactivity! Less than 12 hours left!';} //if ( $now -= (loop through teams).lastupdate <= 060000) {$warning = $team . 'is in danger of inactivity! Less than 6 hours left!';} //if ( $now -= (loop through teams).lastupdate <= 010000) {$warning = $team . 'is in danger of inactivity! Less than 1 hour left!';} //if ( $now -= (loop through teams).lastupdate <= 000001) {$warning = $team . 'has been declared inactive. If you are the Captain of ' . $team . ', please contact a judge for information concerning your shootout.';} //JUST UNTIL YOU WRITE THE FUNCTION $warning = ''; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////POST TO TWITTER, ALL INACTIVITY EVERYTHINGS ARE POSTED FROM HERE///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// echo <<<END $newfeed $warning $originalfeed <item> <title>RSS Feed Live!</title> <category>post</category> <link>http://lowersouthlounge.com</link> <description> HCHS Live Network RSS feed running! TIME STAMP: $lastmod $lastupdate $now </description> <pubDate>Mon, 27 Apr 2009 08:10:00 EST</pubDate> </item> </channel> </rss> END; ?> Link to comment https://forums.phpfreaks.com/topic/156548-solved-rss-pub-date/ Share on other sites More sharing options...
hchsk Posted May 2, 2009 Author Share Posted May 2, 2009 hahaha, i think i just solved this one myself, date() needs Y rather than y Link to comment https://forums.phpfreaks.com/topic/156548-solved-rss-pub-date/#findComment-824288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.