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


PHP Paginate::offset方法代码示例

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


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

示例1: exit

!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
 * @author  ryan <cumt.xiaochi@gmail.com>
 */
switch ($target) {
    case 'gold_price':
        $time_start = _get('time_start');
        $time_end = _get('time_end');
        $type = _get('type');
        $material_types = $config['material_type_map'];
        $p = _get('p') ?: 1;
        $per_page = 50;
        $total = Price::total($type);
        $paging = new Paginate($per_page, $total);
        $paging->setCurPage($p);
        $prices = Price::history(array('type' => $type, 'limit' => $per_page, 'offset' => $paging->offset()));
        break;
    case 'sale':
        $divide = _get('divide') ?: 'day';
        // day or month
        $format_map = array('day' => 'Y年m月d日', 'month' => 'Y年m月');
        $data = Statistics::saleRecord(compact('divide'));
        $date = new DateTime();
        $format = $format_map[$divide];
        $date->sub(DateInterval::createFromDateString("1 {$divide}"));
        $end = $date->format($format);
        $date->sub(DateInterval::createFromDateString("59 {$divide}"));
        $start = $date->format($format);
        break;
    default:
        throw new Exception("unkown target: {$target}");
开发者ID:name3,项目名称:cheng,代码行数:31,代码来源:statistics.php

示例2: Factory

    $factory = new Factory($target);
    $time_start = _get('time_start');
    $time_end = _get('time_end');
    $type = _get('type');
    $sort = _get('sort');
    $conds = compact('time_start', 'time_end', 'type', 'sort');
    switch ($argument) {
        case 'stone':
            $types = $config['st_type'];
            $account = $factory->stAccount();
            break;
        case 'account':
            $types = $config['account_type'];
            $account = $factory->account();
            $orders = Order::listOrder(array('factory_id' => $factory->id));
            break;
        default:
            throw new Exception("arg: {$argument}", 1);
            break;
    }
    $per_page = 50;
    $total = $account->countHistory($conds);
    $paging = new Paginate($per_page, $total);
    $paging->setCurPage(_get('p') ?: 1);
    $history = $account->history(array_merge($conds, array('limit' => $per_page, 'offset' => $paging->offset())));
    $matter = "{$view}.{$argument}";
} else {
    $matter = $view . ($target ? ".{$target}" : '');
}
$view = 'board?master';
$page['scripts'][] = 'jquery.validate.min';
开发者ID:name3,项目名称:cheng,代码行数:31,代码来源:factory.php

示例3: Paginate

<?php 
require_once "admin/includes/init.php";
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$item_per_page = 2;
$item_total_count = Photo::count_all();
$paginate = new Paginate($page, $item_per_page, $item_total_count);
$sql = "SELECT * FROM photos LIMIT {$item_per_page} OFFSET {$paginate->offset()}";
$photos = Photo::find_by_query($sql);
//$photos=Photo::find_all();
?>

<?php 
include "includes/header.php";
?>


        <div class="row">

            <!-- Blog Entries Column -->
            <div class="col-md-8">

  <p style="color: red;"><?php 
echo $session->message();
?>
</p>

            </div>
        </div>

<!---->
开发者ID:kamy333,项目名称:rajah,代码行数:30,代码来源:photo_gallery.php

示例4: Paginate

<?php

include 'includes/header.php';
include 'admin/includes/init.php';
$current_page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$items_per_page = 2;
$items_total_count = Photo::count_all();
$paginate = new Paginate($current_page, $items_per_page, $items_total_count);
$sql = "SELECT * FROM photos LIMIT " . $items_per_page . " OFFSET " . $paginate->offset();
$photos = Photo::find_this_query($sql);
?>


        <div class="row">

            <!-- Blog Entries Column -->
            <div class="col-md-12">
                <div class="thumbnails row">
                <?php 
foreach ($photos as $photo) {
    ?>

                    <div class="col-xs-6 col-md3">
                        <a class="thumbnail" href="photo.php?id=<?php 
    echo $photo->id;
    ?>
">
                            <img class="img-responsive home-page-photo" src="admin/<?php 
    echo $photo->picture_path();
    ?>
" alt="">
开发者ID:Jojnas,项目名称:gallery_php,代码行数:31,代码来源:index.php

示例5: offset

 /**
  * Get SQL OFFSET clause to find.
  * 
  * @return int
  */
 private static function offset()
 {
     return self::$offset = self::$page * self::limit() - self::limit();
 }
开发者ID:xtiurti,项目名称:web-service-lavanderia-encoder,代码行数:9,代码来源:paginate.php

示例6: list

        // get some divs
        if ($by_ajax && is_numeric($target) && preg_match('/get_.+_div/', $action)) {
            include FrameFile::controller('order.get_div');
            exit;
        }
        // 对订单的操作,通过表单post过来的
        if ($action && $by_post && is_numeric($target)) {
            include FrameFile::controller('order.control');
            exit;
        }
        list($customer, $username, $factory) = _get('customer', 'username', 'factory');
        $conds = array_merge($conds, compact('username', 'factory'));
        $page['styles'][] = 'admin';
        break;
    default:
        throw new Exception("unkown user type: {$user_type}");
        break;
}
$conds['customer'] = $customer;
$per_page = 50;
$total = Order::count($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage(_get('p') ?: 1);
$orders = Order::listOrder(array_merge(array('limit' => $per_page, 'offset' => $paging->offset()), $conds));
// we don't need these two lines
if (empty($orders)) {
    $orders = array();
}
$matter = $view;
$view = 'board?master';
$page['scripts'][] = 'jquery.validate.min';
开发者ID:name3,项目名称:cheng,代码行数:31,代码来源:order.php

示例7: exit

<?php

!defined('IN_PTF') && exit('ILLEGAL EXECUTION');
/**
 * @file    index
 * @author  ryan <cumt.xiaochi@gmail.com>
 * @created Jun 27, 2012 6:24:01 PM
 */
if ($user_type === 'Admin') {
    redirect('order/all');
}
if ($user_type === 'SuperAdmin') {
    redirect('admin');
}
list($name, $no, $stone_size, $type) = _get('name', 'no', 'stone_size', 'type');
$mode = _get('mode') ?: 'list';
$cur_page = _get('p') ?: 1;
$page_num_map = array('list' => 10, 'image' => 24);
$per_page = $page_num_map[$mode];
$conds = compact('name', 'no', 'stone_size', 'type');
$total = Product::count($conds);
$paging = new Paginate($per_page, $total);
$paging->setCurPage($cur_page);
$products = Product::read(array_merge($conds, array('limit' => $per_page, 'offset' => $paging->offset())));
$chosen_map = SesState::chosenProducts();
$types = Product::types();
$view .= '?master';
$page['scripts'][] = 'widget';
开发者ID:name3,项目名称:cheng,代码行数:28,代码来源:index.php

示例8: Exception

        default:
            throw new Exception("unkown action: {$action}");
            break;
    }
}
$types = Product::types();
switch ($target) {
    case '':
        list($name, $no, $type, $sort1, $sort2) = _get('name', 'no', 'type', 'sort1', 'sort2');
        $sort = $sort1 ? $sort1 . ' ' . $sort2 : '';
        $p = _get('p') ?: 1;
        $per_page = 50;
        $total = Product::count(array('name' => $name, 'no' => $no, 'type' => $type));
        $paging = new Paginate($per_page, $total);
        $paging->setCurPage($p);
        $products = Product::listProduct(array('limit' => $per_page, 'offset' => $paging->offset(), 'name' => $name, 'no' => $no, 'type' => $type, 'sort' => $sort));
        break;
    case 'post':
        $types = Product::types();
        list($name, $no, $type, $material, $weight, $rabbet_start, $rabbet_end, $small_stone, $st_weight, $remark) = _post('name', 'no', 'type', 'material', 'weight', 'rabbet_start', 'rabbet_end', 'small_stone', 'st_weight', 'remark');
        $image1 = _post('image1');
        $image1_400 = _post('image1_400');
        $image1_thumb = _post('image1_thumb');
        $image2 = _post('image2');
        $image2_400 = _post('image2_400');
        $image2_thumb = _post('image2_thumb');
        $image3 = _post('image3');
        $image3_400 = _post('image3_400');
        $image3_thumb = _post('image3_thumb');
        $material = _post('material');
        if ($material) {
开发者ID:name3,项目名称:cheng,代码行数:31,代码来源:product.php


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