Example #1
0
 public function page($pagesize = PAGE_SIZE, $model = null, $pageset = 'page')
 {
     $this->model = empty($model) ? $this->model : $model;
     $page = new Page($this->model->total(), $pagesize, 3);
     $this->model->setLimit($page->getLimit());
     $this->tpl->assign($pageset, $page->pageShow());
     $this->tpl->assign('num', ($page->getPage() - 1) * $pagesize);
 }
Example #2
0
 protected function page($_pagesize = PAGE_SIZE, $_model = null)
 {
     if (!Validate::isNullString($_model)) {
         $this->_model = $_model;
     }
     $_page = new Page($this->_model->total(), $_pagesize);
     $this->_model->setLimit($_page->getLimit());
     $this->_tpl->assign('page', $_page->showpage());
     $this->_tpl->assign('num', ($_page->getPage() - 1) * $_pagesize);
 }
Example #3
0
 /**
  * (PHP 5 &gt;= 5.4.0)<br/>
  * Specify data which should be serialized to JSON
  * @link http://php.net/manual/en/jsonserializable.jsonserialize.php
  * @return mixed data which can be serialized by <b>json_encode</b>,
  * which is a value of any type other than a resource.
  */
 function jsonSerialize()
 {
     return ['meta' => ['offset' => $this->page->getOffset(), 'limit' => $this->page->getLimit(), 'total' => $this->total], 'data' => $this->results];
 }
Example #4
0
<?php

error_reporting(0);
header('Content-Type:text/html;charset=utf8');
//接口
require 'include/DB.class.php';
require 'include/Image.class.php';
require 'include/Page.class.php';
$total = Image::total($_GET['sid']);
$typename = Image::getTypeName($_GET['sid']);
//分页
$page = new Page($total, 20);
$allImages = Image::getAllImages($_GET['sid'], $page->getLimit());
//需要传递一个参数,1-6表示有六个类,这个参数通过Get方式传递进来
?>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>图片情感标签标注系统-<?php 
echo $typename;
?>
</title> 

<link rel='stylesheet' href='style/style.css' media='screen' />
<link rel="stylesheet" type="text/css" href="style/basic.css">
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/detail.js"></script>
<!--[if lt IE 9]>