PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of SexDev   SDNextPages   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of use
Class: SDNextPages
Easy generation of next/prev links
Author: By
Last change:
Date: 22 years ago
Size: 2,812 bytes
 

Contents

Class file image Download
<?
include('class.SDNextPages.inc');

//array of all links
$links = array(
                array(
'link'=>'http://www.address1.com/', 'name'=>'Address 1'),
                array(
'link'=>'http://www.address2.com/', 'name'=>'Address 2'),
                array(
'link'=>'http://www.address3.com/', 'name'=>'Address 3'),
                array(
'link'=>'http://www.address4.com/', 'name'=>'Address 4'),
                array(
'link'=>'http://www.address5.com/', 'name'=>'Address 5'),
                array(
'link'=>'http://www.address6.com/', 'name'=>'Address 6'),
                array(
'link'=>'http://www.address7.com/', 'name'=>'Address 7'),
                array(
'link'=>'http://www.address8.com/', 'name'=>'Address 8'),
                array(
'link'=>'http://www.address9.com/', 'name'=>'Address 9'),
                array(
'link'=>'http://www.address10.com/', 'name'=>'Address 10'),
                array(
'link'=>'http://www.address11.com/', 'name'=>'Address 11'),
                array(
'link'=>'http://www.address12.com/', 'name'=>'Address 12'),
                array(
'link'=>'http://www.address13.com/', 'name'=>'Address 13'),
                array(
'link'=>'http://www.address14.com/', 'name'=>'Address 14'),
                array(
'link'=>'http://www.address15.com/', 'name'=>'Address 15'),
                array(
'link'=>'http://www.address16.com/', 'name'=>'Address 16'),
                array(
'link'=>'http://www.address17.com/', 'name'=>'Address 17'),
                array(
'link'=>'http://www.address18.com/', 'name'=>'Address 18'),
                array(
'link'=>'http://www.address19.com/', 'name'=>'Address 19'),
                array(
'link'=>'http://www.address20.com/', 'name'=>'Address 20'),
                array(
'link'=>'http://www.address21.com/', 'name'=>'Address 21'),
                array(
'link'=>'http://www.address22.com/', 'name'=>'Address 22'),
                array(
'link'=>'http://www.address23.com/', 'name'=>'Address 23'),
                array(
'link'=>'http://www.address24.com/', 'name'=>'Address 24'),
                array(
'link'=>'http://www.address25.com/', 'name'=>'Address 25'),
                array(
'link'=>'http://www.address26.com/', 'name'=>'Address 26'),
                array(
'link'=>'http://www.address27.com/', 'name'=>'Address 27'),
                array(
'link'=>'http://www.address28.com/', 'name'=>'Address 28'),
                array(
'link'=>'http://www.address29.com/', 'name'=>'Address 29')
            );
//Init class, set all link and links/page
$np = new SDNextPages($links,10);
//display top message "Displaying 1 to 25 of 49 total"
$np->display_top_message();
//print page example, will return array only for current page
foreach($np->final_array as $key => $val){
   
$link = $val['link'];
   
$name = $val['name'];
    echo
"<a href=\"$link\">$name</a><br>";
}
//print next page, number of page, previous page lins
//if you want to add additional parameters to be sended to the
//next page, add it in array format :array('param1'=>'value1','param2'=>'value2');
$additional_papameters = array('param1'=>'value1','param2'=>'value2');
$np->print_links( $additional_papameters );
?>