PHPMaker generates your pagination style (generally, in the page that displays the list of records) based on the setting you chose from PHPMaker application; whether you want to use the drop down style, or link of number style. Unfortunately, you have to choose one of those two options. If you want to switch from one to another style, then you have to re-generate your script files. Besides that, you have to define the value of the page size from PHPMaker application. In other words, there are some preferences that still not provided from the configuration file.
This following customization will give you the flexibility and the ability as following:
- The ability to use the pagination style by simply adjusting the related constant in your configuration (ewcfg8.php) file, so that you will be able to switch it from one to another without having to re-generate your script files.
- The ability to define the pagination position; whether only at the top of the page, only at the bottom of the page, or at the both top and bottom of the page, by setting the related constant in the configuration file, so that you will be able to switch it from one to another without having to re-generate your script files.
- The ability to define the values of the page size in a string format with comma separated between the values, such as: "1, 5, 10, 15, 20" from the related constant in your configuration file. It means that user will be able to switch the page size based on those five option values you defined. This will make you easier to define with your own values from the configuration file anytime you want.
- The ability to define the maximum selected records your user can choose from your configuration file. For example, from the five options above, you should set this maximum selected records value to 20. This will be useful whenever you want to prevent your user displaying the records per page exceed 20 records per page from the related parameter in the URL, then your system will automatically limit to 20 records per page. Generally, this will limit the bandwidth usage of your web application. Does it sound a little smart, huh?
- The ability to define the default maximum record per page when users load the list page, by setting it up from the related constant in the configuration file. This default constant value is derived from the default setting in your PHPMaker application. Of course you can define with your own value from the configuration file.
- The ability whether to display the page number if the maximum record per page not over the page size or not by setting up the related constant in your configuration file. This will be useful if you don't want to display the page number one whenever there is only one page.
- Switch the position of Page Size from the most right to the most left of your pagination style. It does more make sense to show the page size first, and then show the page navigation afterwards. This will make your users easier to select the maximum records per page first, and then they will know how many pages based on that maximum records per page value, following with the information of displaying from record number x to y.
All we have to do is customizing PHPMaker template files. In other words, we will not modify the generated script files.
Please click on the following image below to watch the demo:
[hidepost]
All right, then. Please follow these following steps carefully and chronologically!
-
Open your C:\Program Files\PHPMaker 8\languages\english.xml file, and find this code:
</global>
before that line, insert this following code:
<phrase id="MaximumRecordsPerPage" value="Maximum %t records per page."/>
Do the same way with your another .xml language file, for example, I am also using Indonesian, so I add this following code as the translation of that phrase above in my indonesian.xml file:
<phrase id="MaximumRecordsPerPage" value="Maksimum %t record per halaman."/>
-
Open your ewcfg.php file, and find this code:
// General
before that line, insert this following code:
// Begin of modification by Masino Sinaga, for customize navigation/pager panel, August 27, 2011 define("EW_PAGINATION_STYLE", <!--##=PROJ.PagerStyle##-->, TRUE); // Whether to use drop down selection (2) or numeric link (1) for pagination style define("EW_PAGINATION_POSITION", 3, TRUE); // 1 = Top, 2 = Bottom, 3 = Top and Bottom define("EW_TABLE_SELECTABLE_REC_PER_PAGE_LIST", "1,2,3,5,10,15,20", TRUE); // Selectable records per page list define("EW_TABLE_MAXIMUM_SELECTED_RECORDS", 20, TRUE); // Maximum selected records per page define("EW_TABLE_RECPERPAGE_VALUE", <!--##=PROJ.RecPerPage##-->, TRUE); // Default records per page value define("EW_SHOW_PAGENUM_IF_REC_NOT_OVER_PAGESIZE", TRUE, TRUE); // Whether to show or hide the pagenumber if records not over pagesize. Set the second parameter to FALSE if you want to hide the pagenumber, otherwise set to TRUE in order to always show the pagenumber. // End of modification by Masino Sinaga, for customize navigation/pager panel, August 27, 2011
-
Open your list-script.php file, and find this code:
<!--## If bTopPageLink Then ##--> <!--##=sExpStart##--> <div class="ewGridUpperPanel"> <?php if ($<!--##=gsTblVar##-->->CurrentAction <> "gridadd" && $<!--##=gsTblVar##-->->CurrentAction <> "gridedit") { ?> <!--##include pager.php/pager##--> <?php } ?> <!--##include list-script-inline.php/optionhtml##--> </div> <!--##=sExpEnd##--> <!--## End If ##-->
then replace it with this following code:
<?php if ( (EW_PAGINATION_POSITION==1) || (EW_PAGINATION_POSITION==3) ) { ?> <!--##=sExpStart##--> <div class="ewGridUpperPanel"> <?php if ($<!--##=gsTblVar##-->->CurrentAction <> "gridadd" && $<!--##=gsTblVar##-->->CurrentAction <> "gridedit") { ?> <!--##include pager.php/pager##--> <?php } ?> <!--##include list-script-inline.php/optionhtml##--> </div> <!--##=sExpEnd##--> <?php } ?>
-
Still in the list-script.php file, find again this code:
<!--## If bTopPageLink And bBottomPageLink Then ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <!--## End If ##--> <!--## If bBottomPageLink Or Not bTopPageLink Then ##--> <!--##=sExpStart##--> <div class="ewGridLowerPanel"> <!--## If bBottomPageLink Then ##--> <?php if ($<!--##=gsTblVar##-->->CurrentAction <> "gridadd" && $<!--##=gsTblVar##-->->CurrentAction <> "gridedit") { ?> <!--##include pager.php/pager##--> <?php } ?> <!--## End If ##--> <!--##include list-script-inline.php/optionhtml##--> </div> <!--##=sExpEnd##--> <!--## End If ##--> <!--## If bTopPageLink And bBottomPageLink Then ##--> <?php } ?> <!--## End If ##-->
then replace it with this following code:
<?php if ( (EW_PAGINATION_POSITION==2) || (EW_PAGINATION_POSITION==3) ) { ?> <?php if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <!--##=sExpStart##--> <div class="ewGridLowerPanel"> <?php if ($<!--##=gsTblVar##-->->CurrentAction <> "gridadd" && $<!--##=gsTblVar##-->->CurrentAction <> "gridedit") { ?> <!--##include pager.php/pager##--> <?php } ?> <?php //if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <!--##include list-script-inline.php/optionhtml##--> <?php //} ?> </div> <!--##=sExpEnd##--> <?php } ?> <?php } ?>
-
Open your view-script.php file, and find this code:
<!--## If bDetailViewPaging And bTopPageLink Then ##--> <!--##=sExpStart##--> <!--##include pager.php/pager##--> <br /> <!--##=sExpEnd##--> <!--## End If ##-->
then replace it with this following code:
<?php if ( (EW_PAGINATION_POSITION==1) || (EW_PAGINATION_POSITION==3) ) { ?> <!--##=sExpStart##--> <!--##include pager.php/pager##--> <br /> <!--##=sExpEnd##--> <?php } ?>
-
Still in the view-script.php file, find again this code:
<!--## If bDetailViewPaging And bBottomPageLink Then ##--> <!--##=sExpStart##--> <br /> <!--##include pager.php/pager##--> <!--##=sExpEnd##--> <!--## End If ##-->
then replace it with this following code:
<?php if ( (EW_PAGINATION_POSITION==2) || (EW_PAGINATION_POSITION==3) ) { ?> <!--##=sExpStart##--> <br /> <!--##include pager.php/pager##--> <!--##=sExpEnd##--> <?php } ?>
-
Open your list-script-function.php file, and find this code:
function SetUpDisplayRecs() { global $<!--##=gsTblVar##-->;
after the last line of that code, insert this following code:
global $Language; $sWrk = @$_GET[EW_TABLE_REC_PER_PAGE]; if ($sWrk > EW_TABLE_MAXIMUM_SELECTED_RECORDS) { $sWrk = EW_TABLE_MAXIMUM_SELECTED_RECORDS; $this->setFailureMessage(str_replace("%t", EW_TABLE_MAXIMUM_SELECTED_RECORDS, $Language->Phrase("MaximumRecordsPerPage"))); }
-
Still in the list-script-function.php file, find again this code:
$this->DisplayRecs = <!--##=iRecPerPage##-->; // Non-numeric, load default
then replace it with this following code:
$this->DisplayRecs = EW_TABLE_RECPERPAGE_VALUE; // <!--##=iRecPerPage##-->; // Non-numeric, load default
-
Open your list-script.php file, and find this code:
var $DisplayRecs = <!--##=iRecPerPage##-->;
then replace it with this following code:
var $DisplayRecs = EW_TABLE_RECPERPAGE_VALUE; // <!--##=iRecPerPage##-->;
-
Still in the list-script.php file, find again this code:
$this->DisplayRecs = <!--##=iRecPerPage##-->; // Load default
then replace it with this following code:
$this->DisplayRecs = EW_TABLE_RECPERPAGE_VALUE; // <!--##=iRecPerPage##-->; // Load default
-
Open your pager.php file, and replace all of the code in that file with this following code:
<!--##session pager##--> <!--## sImageFolder = ew_FolderPath("_images") sImageFolder = ew_RelFolder(sImageFolder) ##--> <form name="ewpagerform" id="ewpagerform" class="searchpanel" action="<?php echo ew_CurrentPage() ?>"> <table border="0" cellspacing="0" cellpadding="0" class="ewPager"> <tr> <td nowrap> <?php if (EW_PAGINATION_STYLE==1) { ?> <span class="phpmaker"> <?php if (!isset($<!--##=sPageObj##-->->Pager)) $<!--##=sPageObj##-->->Pager = new cNumericPager($<!--##=sPageObj##-->->StartRec, $<!--##=sPageObj##-->->DisplayRecs, $<!--##=sPageObj##-->->TotalRecs, $<!--##=sPageObj##-->->RecRange) ?> <?php if ($<!--##=sPageObj##-->->Pager->RecordCount > 0) { ?> <!--## If sRecPerPageList <> "" And LCase(CTRL.CtrlID) = "list" Then arrRecPerPage = split(sRecPerPageList,",") ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <!--##@RecordsPerPage##--> </td><td> <input type="hidden" id="t" name="t" value="<!--##=gsTblVar##-->" /> <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onchange="this.form.submit();"> <?php $sRecPerPageList = explode(',',EW_TABLE_SELECTABLE_REC_PER_PAGE_LIST); foreach ($sRecPerPageList as $a) { $thisDisplayRecs = $a; if ($thisDisplayRecs > 0 ) { $thisValue = $thisDisplayRecs; ?> <option value="<?php echo $thisDisplayRecs; ?>"<?php if ($<!--##=sPageObj##-->->DisplayRecs == $thisValue) { ?> selected="selected"<?php } ?> /><?php echo $thisDisplayRecs; ?></option> <?php } else { ?> <option value="ALL"<?php if ($<!--##=gsTblVar##-->->getRecordsPerPage() == -1) { ?> selected="selected"<?php } ?>><!--##@AllRecords##--></option> <?php } } ?> </select> <?php } ?> <!--## End If ##--> <?php if ($<!--##=sPageObj##-->->Pager->FirstButton->Enabled) { ?> <a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->FirstButton->Start ?>"><b><!--##@PagerFirst##--></b></a> <?php } ?> <?php if ($<!--##=sPageObj##-->->Pager->PrevButton->Enabled) { ?> <a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->PrevButton->Start ?>"><b><!--##@PagerPrevious##--></b></a> <?php } ?> <?php foreach ($<!--##=sPageObj##-->->Pager->Items as $PagerItem) { ?> <?php if ($PagerItem->Enabled) { ?><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $PagerItem->Start ?>"><?php } ?><b><?php echo $PagerItem->Text ?></b><?php if ($PagerItem->Enabled) { ?></a><?php } ?> <?php } ?> <?php if ($<!--##=sPageObj##-->->Pager->NextButton->Enabled) { ?> <a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->NextButton->Start ?>"><b><!--##@PagerNext##--></b></a> <?php } ?> <?php if ($<!--##=sPageObj##-->->Pager->LastButton->Enabled) { ?> <a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->LastButton->Start ?>"><b><!--##@PagerLast##--></b></a> <?php } ?> <!--## If LCase(CTRL.CtrlID) = "list" Then ##--> <?php if ($<!--##=sPageObj##-->->Pager->ButtonCount > 0) { ?> <?php } ?> <!--##@Record##--> <?php echo $<!--##=sPageObj##-->->Pager->FromIndex ?> <!--##@To##--> <?php echo $<!--##=sPageObj##-->->Pager->ToIndex ?> <!--##@Of##--> <?php echo $<!--##=sPageObj##-->->Pager->RecordCount ?> <!--## End If ##--> <?php } else { ?> <!--## If bUserLevel And Not bAnonymousList Then ##--> <?php if ($Security->CanList()) { ?> <!--## End If ##--> <?php if ($<!--##=sPageObj##-->->sSrchWhere == "0=101") { ?> <!--##@EnterSearchCriteria##--> <?php } else { ?> <!--##@NoRecord##--> <?php } ?> <!--## If bUserLevel And Not bAnonymousList Then ##--> <?php } else { ?> <!--##@NoPermission##--> <?php } ?> <!--## End If ##--> <?php } ?> </span> <?php } elseif (EW_PAGINATION_STYLE==2) { ?> <?php if (!isset($<!--##=sPageObj##-->->Pager)) $<!--##=sPageObj##-->->Pager = new cPrevNextPager($<!--##=sPageObj##-->->StartRec, $<!--##=sPageObj##-->->DisplayRecs, $<!--##=sPageObj##-->->TotalRecs) ?> <?php if ($<!--##=sPageObj##-->->Pager->RecordCount > 0) { ?> <?php if (($<!--##=sPageObj##-->->Pager->PageCount==1) && ($<!--##=sPageObj##-->->Pager->CurrentPage == 1) ) { ?> <!--## If sRecPerPageList <> "" And LCase(CTRL.CtrlID) = "list" Then arrRecPerPage = split(sRecPerPageList,",") ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <td><table border="0" cellspacing="0" cellpadding="0"><tr><td><!--##@RecordsPerPage##--> </td><td> <input type="hidden" id="t" name="t" value="<!--##=gsTblVar##-->" /> <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onchange="this.form.submit();"> <?php $sRecPerPageList = explode(',',EW_TABLE_SELECTABLE_REC_PER_PAGE_LIST); foreach ($sRecPerPageList as $a) { $thisDisplayRecs = $a; if ($thisDisplayRecs > 0 ) { $thisValue = $thisDisplayRecs; ?> <option value="<?php echo $thisDisplayRecs; ?>"<?php if ($<!--##=sPageObj##-->->DisplayRecs == $thisValue) { ?> selected="selected"<?php } ?> /><?php echo $thisDisplayRecs; ?></option> <?php } else { ?> <option value="ALL"<?php if ($<!--##=gsTblVar##-->->getRecordsPerPage() == -1) { ?> selected="selected"<?php } ?>><!--##@AllRecords##--></option> <?php } } ?> </select></td></tr></table> </td> <?php } ?> <!--## End If ##--> <?php if (EW_SHOW_PAGENUM_IF_REC_NOT_OVER_PAGESIZE) { ?> <td> <span class="phpmaker"><!--##@Page##--> </span></td> <!--first page button--> <?php if ($<!--##=sPageObj##-->->Pager->FirstButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->FirstButton->Start ?>"><img src="<!--##=sImageFolder##-->first.gif" alt="<!--##@PagerFirst##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->firstdisab.gif" alt="<!--##@PagerFirst##-->" width="16" height="16" border="0"></td> <?php } ?> <!--previous page button--> <?php if ($<!--##=sPageObj##-->->Pager->PrevButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->PrevButton->Start ?>"><img src="<!--##=sImageFolder##-->prev.gif" alt="<!--##@PagerPrevious##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->prevdisab.gif" alt="<!--##@PagerPrevious##-->" width="16" height="16" border="0"></td> <?php } ?> <!--current page number--> <td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $<!--##=sPageObj##-->->Pager->CurrentPage ?>" size="4"></td> <!--next page button--> <?php if ($<!--##=sPageObj##-->->Pager->NextButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->NextButton->Start ?>"><img src="<!--##=sImageFolder##-->next.gif" alt="<!--##@PagerNext##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->nextdisab.gif" alt="<!--##@PagerNext##-->" width="16" height="16" border="0"></td> <?php } ?> <!--last page button--> <?php if ($<!--##=sPageObj##-->->Pager->LastButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->LastButton->Start ?>"><img src="<!--##=sImageFolder##-->last.gif" alt="<!--##@PagerLast##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->lastdisab.gif" alt="<!--##@PagerLast##-->" width="16" height="16" border="0"></td> <?php } ?> <td><span class="phpmaker"> <!--##@of##--> <?php echo $<!--##=sPageObj##-->->Pager->PageCount ?></span></td> <?php } ?> <td> </td> <td> <span class="phpmaker"><!--##@Record##--> <?php echo $<!--##=sPageObj##-->->Pager->FromIndex ?> <!--##@To##--> <?php echo $<!--##=sPageObj##-->->Pager->ToIndex ?> <!--##@Of##--> <?php echo $<!--##=sPageObj##-->->Pager->RecordCount ?></span> </td> <?php } else { ?> <table border="0" cellspacing="0" cellpadding="0"> <!--## If sRecPerPageList <> "" And LCase(CTRL.CtrlID) = "list" Then arrRecPerPage = split(sRecPerPageList,",") ##--> <?php if ($<!--##=sPageObj##-->->TotalRecs > 0) { ?> <td><table border="0" cellspacing="0" cellpadding="0"><tr><td><!--##@RecordsPerPage##--> </td><td> <input type="hidden" id="t" name="t" value="<!--##=gsTblVar##-->" /> <select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onchange="this.form.submit();"> <?php $sRecPerPageList = explode(',',EW_TABLE_SELECTABLE_REC_PER_PAGE_LIST); foreach ($sRecPerPageList as $a) { $thisDisplayRecs = $a; if ($thisDisplayRecs > 0 ) { $thisValue = $thisDisplayRecs; ?> <option value="<?php echo $thisDisplayRecs; ?>"<?php if ($<!--##=sPageObj##-->->DisplayRecs == $thisValue) { ?> selected="selected"<?php } ?> /><?php echo $thisDisplayRecs; ?></option> <?php } else { ?> <option value="ALL"<?php if ($<!--##=gsTblVar##-->->getRecordsPerPage() == -1) { ?> selected="selected"<?php } ?>><!--##@AllRecords##--></option> <?php } } ?> </select></td></tr></table> </td> <td> </td> <?php } ?> <!--## End If ##--> <td><span class="phpmaker"><!--##@Page##--> </span></td> <!--first page button--> <?php if ($<!--##=sPageObj##-->->Pager->FirstButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->FirstButton->Start ?>"><img src="<!--##=sImageFolder##-->first.gif" alt="<!--##@PagerFirst##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->firstdisab.gif" alt="<!--##@PagerFirst##-->" width="16" height="16" border="0"></td> <?php } ?> <!--previous page button--> <?php if ($<!--##=sPageObj##-->->Pager->PrevButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->PrevButton->Start ?>"><img src="<!--##=sImageFolder##-->prev.gif" alt="<!--##@PagerPrevious##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->prevdisab.gif" alt="<!--##@PagerPrevious##-->" width="16" height="16" border="0"></td> <?php } ?> <!--current page number--> <td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $<!--##=sPageObj##-->->Pager->CurrentPage ?>" size="4"></td> <!--next page button--> <?php if ($<!--##=sPageObj##-->->Pager->NextButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->NextButton->Start ?>"><img src="<!--##=sImageFolder##-->next.gif" alt="<!--##@PagerNext##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->nextdisab.gif" alt="<!--##@PagerNext##-->" width="16" height="16" border="0"></td> <?php } ?> <!--last page button--> <?php if ($<!--##=sPageObj##-->->Pager->LastButton->Enabled) { ?> <td><a href="<?php echo $<!--##=sPageObj##-->->PageUrl() ?>start=<?php echo $<!--##=sPageObj##-->->Pager->LastButton->Start ?>"><img src="<!--##=sImageFolder##-->last.gif" alt="<!--##@PagerLast##-->" width="16" height="16" border="0"></a></td> <?php } else { ?> <td><img src="<!--##=sImageFolder##-->lastdisab.gif" alt="<!--##@PagerLast##-->" width="16" height="16" border="0"></td> <?php } ?> <td><span class="phpmaker"> <!--##@of##--> <?php echo $<!--##=sPageObj##-->->Pager->PageCount ?></span></td> </tr></table> <!--## If LCase(CTRL.CtrlID) = "list" Then ##--> </td> <td> </td> <td> <span class="phpmaker"><!--##@Record##--> <?php echo $<!--##=sPageObj##-->->Pager->FromIndex ?> <!--##@To##--> <?php echo $<!--##=sPageObj##-->->Pager->ToIndex ?> <!--##@Of##--> <?php echo $<!--##=sPageObj##-->->Pager->RecordCount ?></span> <!--## End If ##--> <?php } ?> <?php } else { ?> <!--## If bUserLevel And Not bAnonymousList Then ##--> <?php if ($Security->CanList()) { ?> <!--## End If ##--> <?php if ($<!--##=sPageObj##-->->sSrchWhere == "0=101") { ?> <span class="phpmaker"><!--##@EnterSearchCriteria##--></span> <?php } else { ?> <span class="phpmaker"><!--##@NoRecord##--></span> <?php } ?> <!--## If bUserLevel And Not bAnonymousList Then ##--> <?php } else { ?> <span class="phpmaker"><!--##@NoPermission##--></span> <?php } ?> <!--## End If ##--> <?php } ?> <?php } // End of Pagination Style ?> </td> </tr> </table> </form> <!--##/session##--> <?php <!--##session pagerfunction##--> // Set up starting record parameters function SetUpStartRec() { global $<!--##=gsTblVar##-->; if ($this->DisplayRecs == 0) return; if ($this->IsPageRequest()) { // Validate request if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter $this->StartRec = $_GET[EW_TABLE_START_REC]; $<!--##=gsTblVar##-->->setStartRecordNumber($this->StartRec); } elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") { $this->nPageNo = $_GET[EW_TABLE_PAGE_NO]; if (is_numeric($this->nPageNo)) { $this->StartRec = ($this->nPageNo-1)*$this->DisplayRecs+1; if ($this->StartRec <= 0) { $this->StartRec = 1; } elseif ($this->StartRec >= intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1) { $this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; } $<!--##=gsTblVar##-->->setStartRecordNumber($this->StartRec); } } } $this->StartRec = $<!--##=gsTblVar##-->->getStartRecordNumber(); // Check if correct start record counter if (!is_numeric($this->StartRec) || $this->StartRec == "") { // Avoid invalid start record counter $this->StartRec = 1; // Reset start record counter $<!--##=gsTblVar##-->->setStartRecordNumber($this->StartRec); } elseif (intval($this->StartRec) > intval($this->TotalRecs)) { // Avoid starting record > total records $this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to last page first record $<!--##=gsTblVar##-->->setStartRecordNumber($this->StartRec); } elseif (($this->StartRec-1) % $this->DisplayRecs <> 0) { $this->StartRec = intval(($this->StartRec-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to page boundary $<!--##=gsTblVar##-->->setStartRecordNumber($this->StartRec); } } <!--##/session##--> ?>
[/hidepost]
Leave a Reply
You must be logged in to post a comment.