Barebone\Paginator

Source

<?php

// Coalesce Operator
$start = $_GET['start'] ?? 1;
$per_page = 10;
$total_rows = 1000;
$paginator = new Barebone\Paginator($start,$per_page,$total_rows,'./');
$this->view->paginator = $paginator->generate_links(true);

// Or the long way around
$start = $_GET['start'] ?? 1;		
$per_page = 8;
$total_rows = 677;
$paginator = new Barebone\Paginator();
$paginator->setBase_url('./');
$paginator->setCurrent_page($start);
$paginator->setPer_page($per_page);
$paginator->setTotal_rows($total_rows);
$paginator->setNum_links( 8 );
//print_r($paginator);
$this->view->paginator = $paginator;
            
Barebone\Paginator Object
(
    [tag:protected] => ul
    [innertext:protected] => 
    [children:protected] => Array
        (
            [0] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => First
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=0
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [1] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => Previous
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=368
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [2] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 312
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=312
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [3] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 320
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=320
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [4] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 328
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=328
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [5] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 336
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=336
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [6] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 344
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=344
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [7] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 352
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=352
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [8] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 360
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=360
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [9] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 368
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=368
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [10] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => span
                                    [innertext:protected] => 376
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                            [class] => Barebone\HTML\TAttribute Object
                                (
                                    [name] => class
                                    [value] => active
                                )

                        )

                )

            [11] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 384
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=384
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [12] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 392
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=392
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [13] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 400
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=400
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [14] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 408
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=408
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [15] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 416
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=416
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [16] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 424
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=424
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [17] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 432
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=432
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [18] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => 440
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=440
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [19] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => Next
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=384
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

            [20] => Barebone\HTML\TElement Object
                (
                    [tag:protected] => li
                    [innertext:protected] => 
                    [children:protected] => Array
                        (
                            [0] => Barebone\HTML\TElement Object
                                (
                                    [tag:protected] => a
                                    [innertext:protected] => Last
                                    [children:protected] => Array
                                        (
                                        )

                                    [attributes:protected] => Array
                                        (
                                            [href] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => href
                                                    [value] => ./?start=672
                                                )

                                            [class] => Barebone\HTML\TAttribute Object
                                                (
                                                    [name] => class
                                                    [value] => nav-buttons
                                                )

                                        )

                                )

                        )

                    [attributes:protected] => Array
                        (
                        )

                )

        )

    [attributes:protected] => Array
        (
            [class] => Barebone\HTML\TAttribute Object
                (
                    [name] => class
                    [value] => pagination
                )

        )

    [base_url:Barebone\Paginator:private] => ./
    [total_rows:Barebone\Paginator:private] => 677
    [per_page:Barebone\Paginator:private] => 8
    [num_links:Barebone\Paginator:private] => 8
    [current_page:Barebone\Paginator:private] => 48
    [first_link_txt:Barebone\Paginator:private] => First
    [next_link_txt:Barebone\Paginator:private] => Next
    [prev_link_txt:Barebone\Paginator:private] => Previous
    [last_link_txt:Barebone\Paginator:private] => Last
    [first_link:Barebone\Paginator:private] => Barebone\HTML\TElement Object
        (
            [tag:protected] => a
            [innertext:protected] => First
            [children:protected] => Array
                (
                )

            [attributes:protected] => Array
                (
                    [href] => Barebone\HTML\TAttribute Object
                        (
                            [name] => href
                            [value] => ./?start=0
                        )

                    [class] => Barebone\HTML\TAttribute Object
                        (
                            [name] => class
                            [value] => nav-buttons
                        )

                )

        )

    [next_link:Barebone\Paginator:private] => 
    [prev_link:Barebone\Paginator:private] => 
    [last_link:Barebone\Paginator:private] => 
    [page_link:Barebone\Paginator:private] => 
)
  • Barebone\Paginator

    Barebone\Paginator extends Barebone\HTML\TElement
    • [P] $base_url : string
    • [P] $total_rows : int
    • [P] $per_page : int
    • [P] $num_links : int
    • [P] $current_page : int
    • [P] $first_link_txt : string
    • [P] $next_link_txt : string
    • [P] $prev_link_txt : string
    • [P] $last_link_txt : string
    • [P] $first_link : THtml
    • [P] $next_link : THtml
    • [P] $prev_link : THtml
    • [P] $last_link : THtml
    • [P] $page_link : THtml
    • [M] __construct( int $cur_page, int $per_page, int $total_rows, string $base_url ) : void
    • [M] getBase_url() : string
    • [M] getTotal_rows() : int
    • [M] getPer_page() : int
    • [M] getNum_links() : int
    • [M] getCurrent_page() : int
    • [M] getFirst_link_txt() : string
    • [M] getNext_link_txt() : string
    • [M] getPrev_link_txt() : string
    • [M] getLast_link_txt() : string
    • [M] setBase_url( string $base_url ) : Barebone\Paginator
    • [M] setTotal_rows( int $total_rows ) : Barebone\Paginator
    • [M] setPer_page( int $per_page ) : Barebone\Paginator
    • [M] setNum_links( int $num_links ) : Barebone\Paginator
    • [M] setCurrent_page( int $current_page ) : Barebone\Paginator
    • [M] setFirst_link_txt( string $first_link_txt ) : Barebone\Paginator
    • [M] setNext_link_txt( string $next_link_txt ) : Barebone\Paginator
    • [M] setPrev_link_txt( string $prev_link_txt ) : Barebone\Paginator
    • [M] setLast_link_txt( string $last_link_txt ) : Barebone\Paginator
    • [M] generate_links( bool $return ) : mixed
    • Barebone\HTML\TElement

      Barebone\HTML\TElement
      • [P] $tag : string
      • [P] $innertext : string
      • [P] $children : array
      • [P] $attributes : array
      • [P] $non_closing_tags : mixed
      • [M] __construct( string $tag, array $attributes ) : void
      • [M] append( Barebone\HTML\TElement $element ) : void
      • [M] prepend( Barebone\HTML\TElement $element ) : void
      • [M] class_exists( $cssclass ) : void
      • [M] add_class( $cssclass ) : void
      • [M] remove_class( $cssclass ) : void
      • [M] innertext( string $value ) : void
      • [M] data( string $name, string $value ) : void
      • [M] aria( string $name, string $value ) : void
      • [M] on( string $event, string $callback ) : void
      • [M] css( string $identifier, string $rule ) : void
      • [M] wrap( string $tagname, array $attributes ) : void
      • [M] enable() : void
      • [M] disable() : void
      • [M] has_closing_tag() : void
      • [M] has_children() : void
      • [M] count_children() : void
      • [M] get_children() : void
      • [M] replace_child( $key, $new_child ) : void
      • [M] get_child( $key ) : void
      • [M] __unset( $name ) : void
      • [M] __isset( $name ) : void
      • [M] __set( $name, $value ) : void
      • [M] __get( $name ) : void
      • [M] render() : void
      • [M] __toString() : string
      • [M] editable() : void