Login   Register  
PHP Classes
elePHPant
Icontem

File: class.pager.docs.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of spajus  >  Page Magic  >  class.pager.docs.txt  >  Download  
File: class.pager.docs.txt
Role: Documentation
Content type: text/plain
Description: Class documentation
Class: Page Magic
Generate pagination HTML links with text templates
Author: By
Last change: done a tiny text formatting...
Date: 2004-10-21 02:05
Size: 26,039 bytes
 

Contents

Class file image Download
              Pager Class Documentation


                                                   Contents
                                                           
Package Pager Classes                                                                                                 1
       Class pager                                                                                                    1
          Var $but_next                                                                                               1
          Var $but_page                                                                                               1
          Var $but_page_this                                                                                          2
          Var $but_prev                                                                                               2
          Var $num_results                                                                                            2
          Var $page                                                                                                   2
          Var $page_identifier                                                                                        2
          Var $page_list_size                                                                                         2
          Var $per_page                                                                                               2
          Var $query_string                                                                                           3
          Var $range_display                                                                                          3
          Var $separator                                                                                              3
          Constructor pager                                                                                           3
          Method getButList                                                                                           3
          Method getButNext                                                                                           4
          Method getButPage                                                                                           4
          Method getButPrev                                                                                           4
          Method getPageFrom                                                                                          4
          Method getPageTo                                                                                            5
          Method getRangeInfo                                                                                         5
Appendices                                                                                                            6
       Appendix A - Class Trees                                                                                       7
          Pager                                                                                                       7


                             Package Pager Classes                                                 
 
                                                                
                                    
                                                                                                    

                                                                                                    
                                                  Class pager                                        
                                                           [line 13]                                 
  Pager class  For doing the page-related math and generating page links (prev 1 2 3 4 5             
        next etc. ).
                                                                                
        
                                                                                            
   
                                                                                                 
   
                                                                                                 
                   Package Pager                                                                     
                   
                                                                                 
                   Copyright (c)2004, Net@Biz                                                        
                   
                                                                                 
                   Version 1.0                                                                       
                   
                                                                                 
                   Author spyefex < tomas@netatbiz.com >                                        
                                                                                                    
                                                                                                    
pager::$but_next
                                                                                    

                                                                                                    
      string =  "<a href=\"{query_string}&page={page}\">next</a>" [line 38] 
                        
  NEXT button html code template
                                                                    
        "{query_string}" and "{page}" will be automatically replaced by the                          
  appropriate values                                                                                 
  
                                                                                                  
pager::$but_page
                                                                                    

                                                                                                    
      string =  "<a href=\"{query_string}&page={page}\">{page}</a>" [line 52]        
               
  Page ( ie.: 1, 2, 3, or 4, etc. ) button html code template
                                       
        "{query_string}" and "{page}" will be automatically replaced by the                          
  appropriate values                                                                                 
                                                                                                    Page 1 of 7


  
                                                                                                  
pager::$but_page_this
                                                                               

                                                                                                    
      string =  "<strong>{page}</strong>" [line 59] 
                                                
  Currently active page button html code template
                                                   
        "{query_string}" and "{page}" will be automatically replaced by the                          
  appropriate values                                                                                 
  
                                                                                                  
pager::$but_prev
                                                                                    

                                                                                                    
      string =  "<a href=\"{query_string}&page={page}\">prev</a>" [line 45] 
                        
  PREVIOUS button html code template
                                                                
        "{query_string}" and "{page}" will be automatically replaced by the                          
  appropriate values                                                                                 
  
                                                                                                  
pager::$num_results
                                                                                 

                                                                                                    
      int =  [line 79]
                                                                              
  Total number of results
                                                                           
        
                                                                                            
pager::$page
                                                                                        

                                                                                                    
      int =  [line 25]
                                                                              
  Currently active page
                                                                             
        
                                                                                            
pager::$page_identifier
                                                                             

                                                                                                    
      string =  [line 31] 
                                                                          
  Page text in query string
                                                                         
        
                                                                                            
pager::$page_list_size
                                                                              

                                                                                                    
      int =  [line 85]
                                                                              
  Number of pages currently available
                                                               
        
                                                                                            
pager::$per_page
                                                                                    

                                                                                                    
      int =  [line 19]
                                                                              
                                                                                                    Page 2 of 7

  Number of results to show per one page
                                                            
        
                                                                                            
pager::$query_string
                                                                                

                                                                                                    
      string =  [line 92] 
                                                                          
  Initial query string for use in button links
                                                      
        Including "file.php?" (Ie.: "index.php?location=heaven")                                     
  
                                                                                                  
pager::$range_display
                                                                               

                                                                                                    
      string =  "Showing results {from} - {to} of {total} " [line 73] 
                              
  Range display template
                                                                            
        "{from}", "{to}" and "{total}" will be automatically                                         
  replaced by the appropriate values                                                                 
  
                                                                                                  
pager::$separator
                                                                                   

                                                                                                    
      string =  " - " [line 66] 
                                                                    
  Separator template
                                                                                
        Will be included among page buttons in page list                                             
  
                                                                                                  
Constructor  function pager::pager($num_results, [$per_page = 10], [$query_string = ''], [$page_id = "page"]) [line
102]                                                                                                 
   Function Parameters:
                                                                             
          int $num_results total number of results ( you should get this from database before        
          constructing the pager object )                                                            
          
                                                                                          
          int $per_page number of results to display in one page                                     
          
                                                                                          
          string $query_string initial query string ( if you are using this pager to display search results,
          $query_string should arrive dynamically according to search query )                        
          
                                                                                          
          string $page_id page identifier variable in query string (ie.: "pg");                      
          
                                                                                          
  Pager initialization
                                                                              
        
                                                                                            
string function pager::getButList([$range = 9]) [line 201]                                           
   Function Parameters:
                                                                             
                                                                                                    Page 3 of 7

          int $range number of page buttons to be shown before and after tbe current page            
          
                                                                                          
  Generates the Google style PAGE button list html code from the predefined templates                
        (ie.: "1 - 2 - 3 - 4 - 5", check initial vars for more information)
                         
        
                                                                                            
string function pager::getButNext($page) [line 153]                                                  
   Function Parameters:
                                                                             
          int $page the page you want to get the NEXT button for ( usually the active page )         
          
                                                                                          
  Generates the NEXT button html code from the predefined template  (check initial vars              
        for more information)
                                                                       
        
                                                                                            
string function pager::getButPage($page) [line 185]                                                  
   Function Parameters:
                                                                             
          int $page the page you want to get the PAGE button for                                     
          
                                                                                          
  Generates the PAGE button html code from the predefined templates  (check initial                  
        vars for more information)
                                                                  
        
                                                                                            
string function pager::getButPrev($page) [line 169]                                                  
   Function Parameters:
                                                                             
          int $page the page you want to get the PREVIOUS button for ( usually the active page )     
          
                                                                                          
  Generates the PREVIOUS button html code from the predefined template  (check initial               
        vars for more information)
                                                                  
        
                                                                                            
int function pager::getPageFrom($page) [line 121]                                                    
   Function Parameters:
                                                                             
          int $page the page you want to get the offset for                                          
          
                                                                                          
                                                                                                    Page 4 of 7



  Gets the result offset for a page.
                                                                
        NOTICE: If you want to use this function to  show the logically correct value for output in  
  html (Ie.: "showing results 1 - 10"),  you should increase the result of this function             
  by 1 (because in real life results  start from 1, not from 0)                                      
  
                                                                                                  
int function pager::getPageTo($page) [line 138]                                                      
   Function Parameters:
                                                                             
          int $page the page you want to get the tail for                                            
          
                                                                                          
  Gets the tail value of results shown in a page.
                                                   
        NOTICE: Do NOT use the results of  this function in database query, it's for outputting      
  the range only.  (Ie.: "showing results 1 - 10")                                                   
  
                                                                                                  
string function pager::getRangeInfo() [line 222]                                                     
  Generates the result range information text from the predefined template  (ie.:                    
        "Displaying 1 - 3 of 24", check initial vars for more information)
                          
        
                                                                                            
                                                                                                    Page 5 of 7



                                              Appendices
                                           
                                                                                                    Page 6 of 7

                           Appendix A - Class Trees
                                                 
                                                  Package Pager
                                     

                                                                                                    
pager                                                                                                
     pager                                                                                           
                                                                                                    Page 7 of 7


                                                        Index
                                                         
C                                                                                                                      
constructor pager::pager()                                                                                            3
            Pager initialization                                                                                       
P                                                                                                                      
pager::getButNext()                                                                                                   4
            Generates the NEXT button html code from the predefined template                                           
             (check initial vars for more information)                                                                 
pager::getButList()                                                                                                   3
            Generates the Google style PAGE button list html code from the predefined templates                        
             (ie.: "1 - 2 - 3 - 4 - 5", check initial vars for more information)                                       
pager::$separator                                                                                                     3
            Separator template                                                                                         
pager::$range_display                                                                                                 3
            Range display template                                                                                     
pager::getButPage()                                                                                                   4
            Generates the PAGE button html code from the predefined templates                                          
             (check initial vars for more information)                                                                 
pager::getButPrev()                                                                                                   4
            Generates the PREVIOUS button html code from the predefined template                                       
             (check initial vars for more information)                                                                 
pager::getRangeInfo()                                                                                                 5
            Generates the result range information text from the predefined template                                   
             (ie.: "Displaying 1 - 3 of 24", check initial vars for more information)                                  
pager::getPageTo()                                                                                                    5
            Gets the tail value of results shown in a page.                                                            
pager::getPageFrom()                                                                                                  4
            Gets the result offset for a page.                                                                         
pager::$query_string                                                                                                  3
            Initial query string for use in button links                                                               
pager::$per_page                                                                                                      2
            Number of results to show per one page                                                                     
pager::$but_page_this                                                                                                 2
            Currently active page button html code template                                                            
pager::$but_page                                                                                                      1
            Page ( ie.: 1, 2, 3, or 4, etc. ) button html code template                                                
pager::$but_next                                                                                                      1
            NEXT button html code template                                                                             
pager::$but_prev                                                                                                      2
            PREVIOUS button html code template                                                                         
pager::$num_results                                                                                                   2
            Total number of results                                                                                    
pager::$page_list_size                                                                                                2