0) { $month_name=$show; } $prevurl = $_GET['prevurl']; if (strlen($prevurl) > 0) { $prevbtn=$prevurl; } $nexturl = $_GET['nexturl']; if (strlen($nexturl) > 0) { $nextbtn=$nexturl; } // if no month is given, show the most current month if ($month_name=="" or $month_name==null) { $result = mysql_query("SELECT * FROM pictures ORDER BY pic_date DESC;"); $picrow = mysql_fetch_array($result); // populate $picdate with the most current picture $picdate = $picrow["pic_date"]; // find the month that matches that picture $result = mysql_query("SELECT * FROM months WHERE ('$picdate' BETWEEN start_date AND end_date);"); $myrow = mysql_fetch_array($result); $month_name = $myrow["month_name"]; } // populate month vars $result = mysql_query("SELECT * FROM months WHERE month_name = '$month_name';"); $myrow = mysql_fetch_array($result); $month_head = $myrow["header_fn"]; $month_foot = $myrow["footer_fn"]; $month_start = $myrow["start_date"]; $month_end = $myrow["end_date"]; // populate the nextbtn and prevbtn variables $result = mysql_query("SELECT month_name, end_date FROM months ORDER BY end_date DESC;"); $found = false; while (!$found) { $myrow = mysql_fetch_array($result); if (($month_name == $myrow["month_name"]) or ($myrow["month_name"]=="" or $myrow["month_name"]==null)) { $found = true; $myrow = mysql_fetch_array($result); } if (!$found) { $next = $myrow["month_name"]; } // echo "$next"; } if ((strlen($prevbtn) == 0) or ($prevbtn == null)) { $prevbtn = $myrow["month_name"]; } if ((strlen($nextbtn) == 0) or ($nextbtn == null)) { $nextbtn = $next; } // $num_pics = mysql_num_rows($result); // echo "Result: $result: $num_pics: $month_start: $month_end: $prevbtn"; // echo "$month"; // **** -- Actual building of the page -- **** // display head of HTML page include("$month_head"); // echo "V:$v Show:$show PrevURL:$prevurl NextURL:$nexturl $month_name"; // if they click on a thumbnail, show them the blow-up version if ($detail) { $prev_pic_fn = ""; $next_pic_fn = ""; $search_done = false; $picresult = mysql_query("SELECT pic_fn FROM pictures WHERE (pic_date >= '$month_start' AND pic_date <= '$month_end') ORDER BY pic_date;"); while (!$search_done) { //save value of next_pic_fn $prev_pic_fn = $next_pic_fn; $picrow = mysql_fetch_array($picresult); $next_pic_fn = $picrow["pic_fn"]; if ($next_pic_fn=="" or $next_pic_fn==null or $next_pic_fn==$pic_fn) { //pic_fn=current_fn or end of recordset if ($next_pic_fn==$pic_fn) { //matched file name -- fetch next file name // $prev_pic_fn = $next_pic_fn; $picrow = mysql_fetch_array($picresult); $next_pic_fn = $picrow["pic_fn"]; } else { //end of recordset } $search_done=true; } } $picresult = mysql_query("SELECT * FROM pictures WHERE pic_fn='$pic_fn';"); $picrow = mysql_fetch_array($picresult); $pic_date = $picrow["pic_date"]; $pic_desc = $picrow["pic_desc"]; $desc = htmlspecialchars($pic_desc); echo "
$pic_date $table_head $table_cell_pic \"$desc\" $table_foot

$table_cell_narrative_font $pic_desc

"; echo "
"; // echo "Prev: $prev_pic_fn"; // echo "Next: $next_pic_fn"; if (strlen($prev_pic_fn) > 0) { echo "\"previous\" "; } echo "\"Show "; if (strlen($next_pic_fn) > 0) { echo "\"next\" "; } } // display the thumbnail view (month) else { // build table $picresult = mysql_query("SELECT * FROM pictures WHERE (pic_date >= '$month_start' AND pic_date <= '$month_end') ORDER BY pic_date;"); // $num_pics = mysql_num_rows($picresult); // echo "Result: $picresult: $num_pics: $month_start: $month_end"; echo "$table_head"; $table_done = false; while (!$table_done) { $row_done = false; $col_pos = 1; echo ""; while (!$row_done) { // get the next image, enumerate variables while (($col_pos <= $table_across) and (!$table_done)) { $picrow = mysql_fetch_array($picresult); $pic_fn = $picrow["pic_fn"]; $pic_desc = $picrow["pic_desc"]; if (!($pic_fn=="" or $pic_fn==null)) { echo "$table_cell_pic"; echo ""; $desc = htmlspecialchars($pic_desc); echo "\"$desc\""; echo "$table_cell_narrative "; echo "$table_cell_narrative_font $pic_desc "; echo ""; } else { $table_done=true; } $col_pos++; } $row_done = true; } echo ""; } // close the table echo "$table_foot"; // display the bottom nav buttons echo "
"; if (strlen($prevbtn) > 0) { echo "\"previous\" "; } echo "\"home\" "; if (strlen($nextbtn) > 0) { echo "\"next\" "; } } // display footer of HTML page include("$month_foot"); ?>