Code

Support for Skinny PHP Pagination

delalick

delalick does not currently provide support for this item.

Popular questions for this item

Installation

To display Skinny PHP Pagination, you’ll have to go through 3 steps:

  1. 1. include it in your code
    // On the PHP side
    require_once '{path_to}/lib/spagination.php';
    // CSS for front-end
    <link type="text/css" rel="stylesheet" href="{path_to}/css/sp.css" />
  2. 2. initiate a Spagination object with count and limit
    $pagi = Spagination::create($count, $limit);
  3. 3. echo the object where you want it displayed
    echo $pagi

That’s all folks :)

Database integration

// Get count of some records in the db
$query = mysql_query('SELECT COUNT(*) FROM table');
$fetched = mysql_fetch_row($query) 
    or die('Unable to count rows: '.mysql_error());
$count = current($fetched);

// Create the Spagination object and set up count & limit per page
$pagi = Spagination::create($count, 15);

// Pagination calculated all needed params, let's get the actual data
$books = mysql_query('
    SELECT * FROM table
    LIMIT '.$pagi->limit().' 
    OFFSET '.$pagi->offset()
) or die('Selection error:'.mysql_error());

Changing Pagination look

Since all setter methods in Skinny Pagination are chainable, changing the look is quite simple:

$pagi
    ->template('digg')
    ->skin('flickr')
    ->colour('red');

Of course, you can call any one of these methods individually at any time. Some users practice the look methods calling right during the actual output:

echo $pagi->template('digg')->skin('fb');
by
by
by
by
by
by