"DS_Session")); $DSPRODUCTIMAGEURL.="/vhistory/"; $DSPRODUCTTHUMBURL.="/vhistory/"; $DSPRODUCTIMAGEDIR.="vhistory/"; $DSPRODUCTTHUMBDIR.="vhistory/"; $page=(int)$_GET['page']; $vhistory=ReadCurrentRecord("vhistory","vhistory_no",1); $smarty->assign("Vhistory",$vhistory); $perpage=4; $q = "SELECT * FROM vhistory_image ORDER BY lastname,firstname"; // find out how many more rows by issuing the query with no ending limit $r=DoQuery("$q LIMIT $page,999999"); $nrecs=mysql_num_rows($r); # Knocked out the "if x > y" bit courtesy an issue in March 2016 # "Next" and "Prev" button would stop working at page 48 of 51 #if ($nrecs > $perpage) { /* Revision made 2013_07_17 Howard requested that the next and previous buttons should only move through the exhibition one at a time. Originally we would advance the exhibition by the $perpage amount Additionally the side navigation was "flattened" so all of the exhibition's images will display rather than just four a a time relative to the ciurrent position. $smarty->assign("next",$page+$perpage); $smarty->assign("prev",$page-($perpage+1) > 0 ? $page-($perpage+1) : 0); */ # $smarty->assign("next",$page+1); # $smarty->assign("prev",$page-1 > 0 ? $page-1 : 0); #} # #else { # $smarty->assign("next",$page); # $smarty->assign("prev",0); #} if ($nrecs > 1) # 1 displays if we have a record. > 1 display if there is a "next" { $smarty->assign("next",$page+1); } else { $smarty->assign("next",false); } $smarty->assign("prev",$page-1 > 0 ? $page-1 : 0); //Revised 2013-07-17 to display ALL images in the navigation at once //$listing=VisualImageArray("$q LIMIT $page,$perpage","visualhistory",$page); $listing=VisualImageArray("$q","visualhistory","0"); //This zero used to be $page... it was used for paginating the navigation and told the VisualImageArray() script which ID to start on ($counter) $smarty->assign("listing",$listing); if (! isset($_REQUEST[page])) { //no param, display the title page // get first image for the 'click here to start' function $start_no=OneSQLValue("SELECT vhistory_image_no FROM vhistory_image ORDER BY lastname,firstname"); //$smarty->assign("start_no",$start_no); //Revision made 2013_07_13 because the visual history exhibition was starting on the second image (start=1) instead of the first (start=0) $smarty->assign("start_no","0"); DSBeginPage($vhistory->title,0,1,2); if (InstantEdit()) { $smarty->assign("instantedit",""); } DSEndPage(0,0,"visual_history.tpl"); return; } else { // read the nth page - NOT that record number! $vhistory_image_no=OneSQLValue("SELECT vhistory_image_no FROM vhistory_image ORDER BY lastname,firstname LIMIT $page,1"); $vhistory_image=ReadCurrentRecord("vhistory_image","vhistory_image_no",$vhistory_image_no); $smarty->assign("Vhistoryimage",$vhistory_image); DSBeginPage($vhistory_image->title,0,1,2); $smarty->assign("instantedit",""); DSEndPage(0,0,"visual_history_detail.tpl"); } ?>