smallflower Posted January 8, 2007 Share Posted January 8, 2007 I'm having issues exploding the info into this calendar code from a flat-file db. The calendar is supposed to highlight days that are noted in the db, which is listed out below:"12","7","2006","#dec0706","linked-day","../images/mobile.gif""12","8","2006","#dec0806","linked-day","../images/audio.gif""12","11","2006","#dec1106","linked-day","../images/email.gif""12","12","2006","#dec1206","linked-day","../images/mobile.gif","../images/audio.gif""12","13","2006","#dec1306","linked-day""1","19","2007","#jan1907","linked-day"[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/ Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 Can we see an example of whats happening? Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155538 Share on other sites More sharing options...
smallflower Posted January 8, 2007 Author Share Posted January 8, 2007 That's the thing, nothing is happening. As you can see from the php code (the attached file) the days where something is happening, an event, that day is supposed to be highlighted blue and link to the HTML quick links below the calendar. I'm sure I'm just doing something wrong in exploding the data from the db into the php code from lines 98-109. Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155540 Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 Can i get all the files you need so i can mess around with this code till it works right... Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155573 Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 You know what... it might be this...@list($link, $classes, $image1, $image2, $image3) = $days[$day];trylist($link, $classes, $image1, $image2, $image3) = each($days[$day]);@ signs scilence error messages, its best not to have them while developing. Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155576 Share on other sites More sharing options...
smallflower Posted January 8, 2007 Author Share Posted January 8, 2007 Thanks for the idea, but it didn't help at all. I've re-attached the php file and the contents of the db are the same as listed above.[attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155593 Share on other sites More sharing options...
DarkendSoul Posted January 8, 2007 Share Posted January 8, 2007 I'd like to point out...[code]function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array()){ $first_of_month = gmmktime(0,0,0,$month,1,$year); $day_names = array();[/code]Odd phrasing of a function... it kinda looks like it started good till $days then the rest could just be in the function if your not going to set them..Also... It loads stuff here[code]//flat file db code $fp = fopen('archives-dates.txt','r'); if (!$fp) {echo 'ERROR: Unable to open file.'; exit;} while (!feof($fp)) { $days = fgets($fp, 1024); //use 2048 if very long lines list ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8) = trim(split ('\|', $line), "\""); }[/code]But it does nothing with it.Another fact, $day is constantly over written.list ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8) = trim(split ('\|', $line), "\""); is unused...Heres a cleaner more organized $days fetching function...[code]//flat file db code $fp = fopen('archives-dates.txt','r'); if ($fp) { $i=0; while (!feof($fp)) { $line = fgets($fp, 1024); $days[$i] = explode(",", $line); //use 2048 if very long lines $i++; } fclose($fp); }[/code]It displays like this.[code]Array( [0] => Array ( [0] => "12" [1] => "7" [2] => "2006" [3] => "#dec0706" [4] => "linked-day" [5] => "../images/mobile.gif" ) [1] => Array ( [0] => "12" [1] => "8" [2] => "2006" [3] => "#dec0806" [4] => "linked-day" [5] => "../images/audio.gif" ) [2] => Array ( [0] => "12" [1] => "11" [2] => "2006" [3] => "#dec1106" [4] => "linked-day" [5] => "../images/email.gif" ) [3] => Array ( [0] => "12" [1] => "12" [2] => "2006" [3] => "#dec1206" [4] => "linked-day" [5] => "../images/mobile.gif" [6] => "../images/audio.gif" ) [4] => Array ( [0] => "12" [1] => "13" [2] => "2006" [3] => "#dec1306" [4] => "linked-day" ) [5] => Array ( [0] => "1" [1] => "19" [2] => "2007" [3] => "#jan1907" [4] => "linked-day" ))[/code] Link to comment https://forums.phpfreaks.com/topic/33291-exploding-from-a-flat-file-db/#findComment-155595 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.