Class Pagination_PHP Tutorial
9: 10: class Page { 11: var $firstRow = 0; // Starting row 12: var $listRows = 0; // Number of list rows displayed per page 13: var $parameter = ""; // Parameters to be taken when page jumps 14: var $totalPages = 0; // Total number of pages 15: var $totalRows = 0; // Total number of rows 16: var $nowPage = 0; // Current page number 17: var $showPageJump = True; //Whether to display the page to jump to18: var $coolPages = 0; //The total number of pages in the paging column19: var $rollPage = 5; //The number of pages displayed on each page of the paging column20 : twenty one: /*--------------------------------------------- ----------------------------- 22: Function: Display paging information Page x of x >> 23: - -------------------------------------------------- --------------------------*/ 24: function prompt() { 25: if(0 == $this->totalRows) { 26 : return; 27: } 28: $this->totalPages=ceil($this->totalRows/$this->listRows); //Total number of pages 29: $this->coolPages = ceil($this->totalPages/ $this->rollPage); 30: if ( $this->firstRow >= $this->totalRows ) { // 2003-12-30 17:18:29 kinger modified 31: $this->nowPage = $this- >totalPages; 32: $this->firstRow = ($this->totalPages-1)*$this->listRows; 33: } else { 34: $this->nowPage=floor($this->firstRow/$this ->listRows+1); //Current page number 35: } 36: $nowCoolPage = ceil($this->nowPage/$this->rollPage); 37: 38: // >> 39: if( $nowCoolPage == 1){ 40: $theFirst = ""; 41: $prePage = ""; 42: }else{ 43: $preRow = ($this->rollPage*($nowCoolPage-1)-1)* $this->listRows; 44: $prePage = "totalRows&$this->parameter>parameter>coolPages){ 48: $nextPage = ""; 49: $theEnd=""; 50: }else { 51: $nextRow = ($nowCoolPage*$this->rollPage)*$this->listRows; 52: $theEndRow = ($this->totalPages-1)*$this->listRows; 53: $nextPage = " totalRows&$this->parameter>>"; 54: $theEnd = "totalRows&$this->parameter>>>"; 55: } 56: // 1 2 3 4 5 57: $linkPage = ""; 58: for ($i=1;$irollPage;$i++){ 59: $page=($nowCoolPage-1)*$this->rollPage+$i; 60: $rows=($page-1)*$ this->listRows; 61: if($page!=$this->nowPage){ 62: if($pagetotalPages){ 63: $linkPage .= " totalRows&$this->parameter>".$page .""; 64: }else{ 65: break; 66: } 67: }else{ 68: if($this->totalPages != 1){ 69: $linkPage .= " [".$page ."

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What happens when the desktop layout is locked? When using the computer, sometimes we may encounter the situation where the desktop layout is locked. This problem means that we cannot freely adjust the position of desktop icons or change the desktop background. So, what exactly is going on when it says that the desktop layout is locked? 1. Understand the desktop layout and locking functions. First, we need to understand the two concepts of desktop layout and desktop locking. Desktop layout refers to the arrangement of various elements on the desktop, including shortcuts, folders, widgets, etc. we can be free

jQuery is a classic JavaScript library that is widely used in web development. It simplifies operations such as handling events, manipulating DOM elements, and performing animations on web pages. When using jQuery, you often encounter situations where you need to replace the class name of an element. This article will introduce some practical methods and specific code examples. 1. Use the removeClass() and addClass() methods jQuery provides the removeClass() method for deletion

You don’t need to enter the WIFI password often, so it’s normal to forget it. Today I will teach you the simplest way to find the password of your own WIFI. It can be done in 3 seconds. To check the WIFI password, use WeChat to scan it. The premise of this method is: there must be a mobile phone that can connect to WIFI. Okay, let’s start the tutorial: Step 1. We enter the phone, pull down from the top of the phone, bring up the status bar, and the WIFI icon. Step 2. Long press the WIFI icon to enter the WLAN settings; long press the WIFI icon. Step 3. Click Connected. Enter the WIFI name of your home, click Share Password, and a QR code will pop up; Step 4 of sharing WIFI password, we take a screenshot and save this QR code; Step 5, long press the WeChat icon on the desktop, and click Scan

Recently, Samsung Display and Microsoft signed an important cooperation agreement. According to the agreement, Samsung Display will develop and supply hundreds of thousands of OLEDoS panels for mixed reality (MR) head-mounted devices to Microsoft. Microsoft is developing an MR device for multimedia content such as games and movies. This device is expected to It will be launched after the OLEDoS specifications are finalized, mainly serving the commercial field, and is expected to be delivered as early as 2026. OLEDoS (OLED on Silicon) technology OLEDoS is a new display technology that deposits OLED on a silicon substrate. Compared with traditional glass substrates, it is thinner and has higher pixels. OLEDoS display and ordinary display

MyBatis is an excellent persistence layer framework. It supports database operations based on XML and annotations. It is simple and easy to use. It also provides a rich plug-in mechanism. Among them, the paging plug-in is one of the more frequently used plug-ins. This article will delve into the principles of the MyBatis paging plug-in and illustrate it with specific code examples. 1. Paging plug-in principle MyBatis itself does not provide native paging function, but you can use plug-ins to implement paging queries. The principle of paging plug-in is mainly to intercept MyBatis

In Linux systems, you can use the pwd command to display the current path. The pwd command is the abbreviation of PrintWorkingDirectory and is used to display the path of the current working directory. Enter the following command in the terminal to display the current path: pwd After executing this command, the terminal will display the full path of the current working directory, such as: /home/user/Documents. In addition, you can use some other options to enhance the functionality of the pwd command. For example, the -P option can display

There are two most common ways to paginate PHP arrays: using the array_slice() function: calculate the number of elements to skip, and then extract the specified range of elements. Use built-in iterators: implement the Iterator interface, and the rewind(), key(), current(), next(), and valid() methods are used to traverse elements within the specified range.

When writing PHP code, using classes is a very common practice. By using classes, we can encapsulate related functions and data in a single unit, making the code clearer, easier to read, and easier to maintain. This article will introduce the usage of PHPClass in detail and provide specific code examples to help readers better understand how to apply classes to optimize code in actual projects. 1. Create and use classes In PHP, you can use the keyword class to define a class and define properties and methods in the class.
