Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Barida Popsana  >  Simple Pagination  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: How to use
Class: Simple Pagination
Generate links to browse paginated listings
Author: By
Last change: Added more comments
Date: 2012-08-11 09:50
Size: 991 bytes
 

Contents

Class file image Download
<?php
    
require_once "pagination.inc.php";
    
$max_rows 12;     //Maximum number of rows to be fetched from the database.. 
    
$page_url "index.php?option=com_spg&view=sentMessages";
    
    
$pn = new pagination($no_vouchers,$max_rows);
    
    
$db_limit $pn->getLimit());    //Returns db limit e.g 0, 12;
    
    //Add the limit to your database query..
    
$db = new mysqli"hostname""username""password""dbname" );
    
    
$sql "SELECT * FROM `products` LIMIT " $db_limit ";";
    
$queried $db->query$sql );
?>
<table style='width: 100%'>
    
<?php while( $fetch $queried->fetch_assoc() ): ?>
    <tr>
        <?php echo "<td>" implode("</td>\n<td>"$fetch) . "</td>\n"?>
    </tr>
<?php endif; ?>
</table>
<?php
    $data 
$pn->getLink($page_url$target); //Specifying $target Returns a Hashed link which invokes a javascript function called loadPn..
    //If not specified, it returns a raw hyperlink which;
    
    
$data .= "<span class='right'>" $pn->getPageLength() . "</span>";
?>