cvs: phpweb / index.php
| From: | Gabor Hojtsy | Date: | Fri, 07 Jun 2002 18:40:16 +0000 |
| Subject: | cvs: phpweb / index.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-10735@lists.php.net to get a copy of this message | ||
goba Fri Jun 7 14:40:16 2002 EDT
Modified files:
/phpweb index.php
Log:
Try to avoid that extra month and event entry on the homepage
(displayed because of the newline on the last line of the CSV file)
Index: phpweb/index.php
diff -u phpweb/index.php:1.245 phpweb/index.php:1.246
--- phpweb/index.php:1.245 Fri Jun 7 06:02:02 2002
+++ phpweb/index.php Fri Jun 7 14:40:15 2002
@@ -83,19 +83,26 @@
</p>
';
-$fp = @fopen("backend/events.csv",'r');
-if($fp) {
- $cm=0;
- while(!feof($fp)) {
- list($d,$m,$y,$url,$desc,$id) = fgetcsv($fp,8192);
- if($cm!=(int)$m) {
- if($cm) $RSIDEBAR_DATA.= "<br />\n";
- else $RSIDEBAR_DATA.='<h3>Upcoming Events<br
/> <a href="submit-event.php">[add
event]</a></h3>';
- $cm = (int)$m;
+// Open events CVS file, and print out event title
+$fp = @fopen("backend/events.csv", "r");
+if ($fp) {
+ $cm = 0;
+ while (!feof($fp)) {
+ list($d, $m, $y, $url, $desc, $id) = fgetcsv($fp, 8192);
+ // fgetcvs returns an array with a single null element for a blank line
+ if ($d === NULL) { continue; }
+ if ($cm != (int) $m) {
+ if ($cm) {
+ $RSIDEBAR_DATA .= "<br />\n";
+ }
+ else {
+ $RSIDEBAR_DATA .= '<h3>Upcoming Events<br
/> <a href="submit-event.php">[add
event]</a></h3>';
+ }
+ $cm = (int) $m;
$RSIDEBAR_DATA .=
"<h4>".strftime('%B',mktime(12,0,0,$cm,$d,$y))."</h4>\n";
unset($seen);
}
- if(!$seen[$desc]) {
+ if (!$seen[$desc]) {
$RSIDEBAR_DATA .= "$d. <a href=\"cal.php?id=$id\">".
stripslashes($desc)."</a><br>\n";
$seen[$desc] = true;
}