Thule - 0.9.6
  • Welcome
  • Introduction
  • - MVC(Model-View-Controller)
    - Architecture of Framework
    - Flow Chart of Application
    - Services In One Server
    - Developing Guide
    - Features
  • Installation
  • Getting Started
  • - Direct Access HTTP
    - Router Access HTTP
    - Router Direct Access HTTP
    - Reserved Function
    - Convention
    - Bootstrap
    - Pack Javascript , CSS
  • Basic Modules
  • - Model
    - View
    - Controller
  • Libraries
  • - Router
    - Config
    - Response
    - Request
    - Database
    - Query
    - Cache
    - Debug
    - Log
    - Unit Test
    - Registry
    - Profile
  • Helper
  • - Auth
    - Calendar
    - Date
    - Error page
    - Email
    - Form
    - GeoIP
    - Google
    - Html Element
    - Html
    - Http
    - I18n
    - Image
    - Json
    - Jquery
    - Login
    - Layout
    - Locale
    - PHP to Javascript
    - Paging
    - Payflow
    - Soap
    - Text
    - Table
    - Uri
    - Upload
    - Validation
  • Plugins
  • - Smarty Template Engine
  • History
  • Home > Paging

    Paging implement is very simple and flexible because of paging data and html page are seperated.
    views/include/paging.html is a sample for paging design.

    Initialize in View

    For the paging , you need to initialize the paging helper for current value and link , etc..

    First param is current value of Get "c".
    Second param is link. Third param is current value link. Fourth param is number of display.

    * Paging initialize must be called before load Controller.

    Url : http://www.thuleframework.com/forum/board?type=1&c=1

    $FE->loadHelper(array("paging","uri","date"));
    $FE->Paging->initialize($FE->Uri->getRequest("c"),$FE->Uri->makeLink(2,"type")."&c=",10);

    Display Paging in View

    Just simplely call the display function

    echo $FE->Paging->display();

    In the Controllers

    $this->loadHelper("paging");
    $this->loadModel(array("forum"),$hconn);
    $this->Paging->setTotalRows($this->Forum->select_board_post_list_totalrows($boardType)); // set the total rows
    $rs=$this->Forum->select_board_post_list($boardType,$this->Paging->pagingQuery()); //pass the paging limit query

    In the Model

    function select_board_post_list($boardType=1,$paging=NULL) {
        $arrSql=array(
            'sql_key'=>'select_forum_board_post_list',
            "query_values"=>array($boardType,$paging));
        return $this->select($arrSql,QUERY_STATIC);
    }

    In the Query

    first ? is for $boardType and second ? is for paging limit.

    select .. where b1.board_type=? ?

    Default Paging File


    If frontend developers want to change the paging design and add the other paging design, they can make it very easily.
    default paging design file : incldue/paging.html

    //First page
    <a href="?php echo $link?><?php echo $first_pos;?>"> << </a>  
    // Previous page
    <a href="<?php echo $link?><?php echo $previous_pos;?>"><</a>
    // pages
    <?php for ($i=$start_pos;$i<=$end_pos;$i++): ?>
    <?php if($i==$cur_pos): ?>
    <a href="<?php echo $link?><?php echo $i;?>"> <b><?php echo $i;?></b> </a>
    <?php else :?>
    <a href="<?php echo $link?><?php echo $i;?>"> <?php echo $i;?> </a>
    <?php endif ?>
    <?php endfor ?>
    // Next Page
    <a href="<?php echo $link?><?php echo $next_pos;?>"> > </a>  
    // Last Page
    <a href="<?php echo $link?><?php echo $last_pos;?>"> >> </a>