当前位置: 首页>>代码示例>>PHP>>正文


PHP Paginate::getPages方法代码示例

本文整理汇总了PHP中Paginate::getPages方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginate::getPages方法的具体用法?PHP Paginate::getPages怎么用?PHP Paginate::getPages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paginate的用法示例。


在下文中一共展示了Paginate::getPages方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     //$this->test();
     $user_rec = new Usr_Schm();
     $user_rec->username = $_POST['username'] ? $_POST['username'] : "";
     $user_rec->password = $_POST['password'] ? $_POST['password'] : "";
     $user_rec->alias = $_POST['alias'] ? $_POST['alias'] : "";
     $user_rec->email = $_POST['email'] ? $_POST['email'] : "";
     $usernfo_rec = new Usrnfo_Schm();
     $usernfo_rec->im = $_POST['im'] ? $_POST['im'] : "";
     $usernfo_rec->name = $_POST['name'] ? $_POST['name'] : "";
     $usernfo_rec->url = $_POST['url'] ? $_POST['url'] : "";
     if (strlen($_POST['add'])) {
         $this->add($user_rec);
     }
     if (strlen($_POST['edit'])) {
         $this->edit($_POST['uid'], $user_rec, $usernfo_rec);
     }
     if (Util::isal_num($this->get['delete']) && $this->get['delete'] !== "") {
         $this->delete($this->get['delete']);
         $msg[] = "Record has been deleted with id: {$this->get['delete']}";
     }
     if (isset($this->get['page'])) {
         $offset = ($this->get['page'] - 1) * DISPLAY_NUM;
         if ($this->get['page'] <= 0) {
             $offset = 0;
         }
     } else {
         $offset = 0;
     }
     $records = "";
     foreach ($this->getRecords(DISPLAY_NUM, $offset) as $row) {
         $records .= "<tr>" . "<td>{$row['uid']}</td>" . "<td>{$row['username']}</td>" . "<td>{$row['alias']}</td>" . "<td>{$row['email']}</td>" . "<td>{$row['im']}</td>" . "<td>{$row['name']}</td>" . "<td>{$row['url']}</td>" . "<td><a href=\"/Users/edit/{$row['uid']}\">edit</a></td>" . "<td><a href=\"/Users/delete/{$row['uid']}\">delete</a></td>" . "</tr>\n";
     }
     $rec = null;
     if (Util::isal_num($this->get['edit'])) {
         $rec = $this->getRecord($this->get['edit']);
     }
     $output['content'] = $records;
     $paginate = new Paginate();
     $paginate->filename("/Users")->bond_id("page")->total($this->getRecordCount())->page_num($this->get['page'] - 1)->total_devisor(DISPLAY_NUM)->query_arg_array($this->get)->build();
     $output['paginate'] = array('next' => $paginate->getNext(), 'prev' => $paginate->getPrev(), 'pages' => $paginate->getPages());
     if ($this->get['submit'] == "true") {
         echo "<pre>Submitting\n" . $this->outputText() . "</pre>";
         exit;
     }
     $controller = Util::tpl_content('public/controller', 'users_tpl.php', array('get' => $this->get, 'output' => $output, 'rec' => $rec, 'msg' => $msg));
     $index = Util::tpl_content('public/body', 'index_tpl.php', array('get' => $this->get, 'title' => "Users"));
     echo Util::tpl_body($controller, $index);
     if (SYSDEBUG) {
         echo $this->outputLogHTML();
     }
 }
开发者ID:robertkraig,项目名称:simplecms,代码行数:53,代码来源:class.controllers.Control_Users.php


注:本文中的Paginate::getPages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。