Location: PHPKode > scripts > Paginator > paginator/static_page.php
<?php
Class Static_page {

  var $file_arr;
	var $directory;

  function Static_page()
  {
	  $this->directory=".";
	}
	function getFileArr()
	{
    if ($handle = opendir($this->directory)) {
      
      $i=0;
      while (false !== ($file = readdir($handle))) {
			  if($file != "." && $file != "..")
				{
        $this->file_arr[$i]=$file;
				$i++;
				}
      }
      closedir($handle);
      }
	} 
	function getPageLinks()
	{   
	    $this->getFileArr();
			$getpage=explode("/",$_SERVER['PHP_SELF']);
      $page = array_pop ($getpage);
      $j = 1;
      foreach($this->file_arr as $v)
       {
       if($v == $page)
       {
         print(" $j ");
       } else { print(" <a href=\"$v\">$j</a> ");}
         $j++;
       }
	}
	function getPrevNext()
	{   
	    $this->getFileArr();
			$getpage=explode("/",$_SERVER['PHP_SELF']);
      $page = array_pop ($getpage);
			sort($this->file_arr);
			$c = count($this->file_arr);
			$j = 0;
      foreach($this->file_arr as $v)
       {
       if($v == $page)
       {
         $current=$j;
       } 
         $j++;
       }
			 $first=$this->file_arr['0'];
			 print(" <a href=\"$first\">First</a> ");
			 if($this->file_arr[$current - 1])
			 { 
			   $prev=$this->file_arr[$current - 1];
			   print(" <a href=\"$prev\">Prev</a> ");
			 } else { print(" Prev "); }
			 print(" " . $current + 1 . " of $c ");
			 if($this->file_arr[$current + 1])
			 { 
			   $next=$this->file_arr[$current + 1];
			   print(" <a href=\"$next\">Next</a> ");
			 } else { print(" Next "); }
			 $last=$this->file_arr[$c - 1];
			 print(" <a href=\"$last\">Last</a> ");
			 
	}
			
}
?>
Return current item: Paginator