Sdfsdfsdfsd

Páginas: 4 (855 palabras) Publicado: 25 de octubre de 2012
TUTORIAL DE NETTUTS.COM
So How Do I Use This Thing?
There are three things you need to do in your index.php file before being able to use your new paginator class. 1. First, include the paginatorclass in the page where you want to use it. I like to use require_once because it ensures that the class will only be included once and if it can’t be found, will cause a fatal error. 2. Next, makeyour database connections. 3. Finally, query your database to get the total number of records that you'll be displaying. Step three is necessary so that the paginator can figure out how many records ithas to deal with. Typically the query can be as simple as SELECT COUNT(*) FROM table WHERE blah blah blah. You're almost there. Now it's time to create a new paginator object, call a few of itsmethods, and set some options. Once you have your total record count from step three above you can add the following code to index.php: 1. 2. 3. 4. 5. $pages = new Paginator; $pages->items_total =$num_rows[0]; $pages->mid_range = 9; $pages->paginate(); echo $pages->display_pages();

Let's break it down...
• •





The first line gives us a shiny new paginator object to play with andinitializes the default values behind the scenes. The second line uses the query we did to get the total number of records and assigns it to our paginator's items_total property. $num_rows is an arraycontaining the result of our count query (you could also use PHP's mysql_num_rows function to retrieve a similar count if you like). The third line tells the paginator the number of page links to display.This number should be odd and greater than three so that the display is symmetrical. For example if the mid range is set to seven, then when browsing page 50 of 100, the mid range will generate links topages 47, 48, 49, 50, 51, 52, and 53. The mid range moves in relation to the selected page. If the user is at either the low or high end of the list of pages, it will slide the range toward the...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • sdfsdfsdfsd
  • sdfsdfsdfsd
  • Sdfsdfsdfsd
  • Sdfsdfsdfsd
  • Sdfsdfsdfsd
  • sdfsdfsdfsd
  • edfsdf sdfd sdf sdf sdfsdfsdfdsdf sdfsdfsdfsd

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS