PHP Classes

File: examples/pagination/example_request_options.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/pagination/example_request_options.php   Download  
File: examples/pagination/example_request_options.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 1,771 bytes
 

Contents

Class file image Download
<html>
<head>
<title>Skeleton - Pagination example - basic</title>
</head>
<body>
<?php
include 'config.php';
include
dirname(__FILE__) . '/../../A/autoload.php';

// initialize an array for testing
for ($i=0; $i<=750; ++$i) {
   
$myarray[$i]['title'] = 'This is row ' . $i;
   
$myarray[$i]['month'] = date ('F', time() + ($i * 60 * 60 * 24 * 30));
}

// create a data object that has the interface needed by the Pager object
$datasource = new Datasource($myarray);

// create a request processor to set pager from GET parameters
$pager = new A_Pagination_Request($datasource);
$pager->setRangeSize(3)->process();

#include 'A/Pagination/View/Standard.php';

$view1 = new A_Pagination_View_Standard($pager);

$view2 = new A_Pagination_View_Standard($pager);
$view2->alwaysShowFirstLast();

$view3 = new A_Pagination_View_Standard($pager);
$view3->alwaysShowPreviousNext();

$view4 = new A_Pagination_View_Standard($pager, false, true);
$view4->alwaysShowFirstLast();
$view4->alwaysShowPreviousNext();

?>

<h3>Standard</h3>
<pre>$view = new A_Pagination_View_Standard($pager);</pre>
<div><?php echo $view1->render(); ?></div>

<h3>Always Show First & Last</h3>
<pre>$view = new A_Pagination_View_Standard($pager);
$view->alwaysShowFirstLast();</pre>
<div><?php echo $view2->render(); ?></div>

<h3>Always Show Previous & Next</h3>
<pre>$view = new A_Pagination_View_Standard($pager);
$view->alwaysShowPreviousNext();</pre>
<div><?php echo $view3->render(); ?></div>

<h3>Show All + Don't Cache Number Of Items </h3>
<pre>$view = new A_Pagination_View_Standard($pager, false, true);
$view->alwaysShowFirstLast();
$view->alwaysShowPreviousNext();</pre>
<div><?php echo $view4->render(); ?></div>

<p><a href="../">Return to Examples</a></p>

</body>
</html>