Location: PHPKode > scripts > Pagerizer > pagerizer/example.php
<?php

/******************************************

Pagerizer Class
-------------------------------------------
With litte to no configuration, this class
will display links to numbered pages or
result sets.
-------------------------------------------

Pagerizer Class is 
Copyright (c) 2008, Bob Kennedy
hide@address.com

You are free to edit and redistribute this
class as you see fit as long as the
copyright statement above if left intact.
If you like it, let me know!

******************************************

Here is some example usage.

The $config array can be left out, and 
defaults will be used.

If you set the third argument in the
pagerizer call, it won't use what is set
in the url for the current page. If left 
blank, and it's not set in the url,
the first page is used (start_number).

******************************************/

require("pagerizer.class.php");
//the total number of pages returned from your query, etc
$total=90;

//the configuration options available. these are not required
$config=array(
	"start_number"=>1, //usually 0 or 1, the first number on the list
	"base_url"=>false, //if set to false, $_SERVER['SCRIPT_NAME'] will be used
	"next"=>">>", //show for "next" link if next page available. set to false for none
	"prev"=>"<<", //show for "prev" link if next page available set to false for none
	"threshold"=>7,  //number of pages needed to use elipses
	"pad_current"=>2, //number of pages on either side of currrent to show and not use elipses for
	"show_every"=>10, //don't elipses these. show links to every 10, 20, etc pages
	"elipses"=>"...", //when skipping pages, use this
	"link_class"=>"pagerizer_link",
	"current_page_class"=>"pagerizer_current_page",
	"elipses_class"=>"pagerizer_elipses",
	"container_div_class"=>"pagerizer_div", //set to false if you don't want a container div
	"span_class"=>"pagerizer_span",
	"pgrzr_get_key"=>"pgrzr" //for url string
);

//Instantiate the class, setting the total pages, the current number we're on, and the config options. The only required one is total.
$p = new pagerizer($total, $config, '');

//Show a basic <style>...</style> for the class names as they are set in the config. You can leave this off to use your own style sheet instead.
//IIf the argument is set to 1, <style> and </style> will be used.
$p -> show_style(1);

//display the page links as configured
$p -> display();

?>
Return current item: Pagerizer