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


PHP CI::pagination方法代码示例

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


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

示例1: index

 public function index($slug, $sort = 'id', $dir = "ASC", $page = 0)
 {
     \CI::lang()->load('categories');
     //define the URL for pagination
     $pagination_base_url = site_url('category/' . $slug . '/' . $sort . '/' . $dir);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     //grab the categories
     $categories = \CI::Categories()->get($slug, $sort, $dir, $page, $per_page);
     //no category? show 404
     if (!$categories) {
         throw_404();
         return;
     }
     $categories['sort'] = $sort;
     $categories['dir'] = $dir;
     $categories['slug'] = $slug;
     $categories['page'] = $page;
     //load up the pagination library
     \CI::load()->library('pagination');
     $config['base_url'] = $pagination_base_url;
     $config['uri_segment'] = 5;
     $config['per_page'] = $per_page;
     $config['num_links'] = 3;
     $config['total_rows'] = $categories['total_products'];
     \CI::pagination()->initialize($config);
     //load the view
     $this->view('categories/category', $categories);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:30,代码来源:Category.php

示例2: index

 public function index($field = 'lastname', $by = 'ASC', $page = 0)
 {
     //we're going to use flash data and redirect() after form submissions to stop people from refreshing and duplicating submissions
     //\CI::session()->set_flashdata('message', 'this is our message');
     $data['page_title'] = lang('customers');
     $data['customers'] = \CI::Customers()->get_customers(50, $page, $field, $by);
     \CI::load()->library('pagination');
     $config['base_url'] = site_url('/admin/customers/index/' . $field . '/' . $by . '/');
     $config['total_rows'] = \CI::Customers()->count_customers();
     $config['per_page'] = 50;
     $config['uri_segment'] = 6;
     $config['first_link'] = 'First';
     $config['first_tag_open'] = '<li>';
     $config['first_tag_close'] = '</li>';
     $config['last_link'] = 'Last';
     $config['last_tag_open'] = '<li>';
     $config['last_tag_close'] = '</li>';
     $config['full_tag_open'] = '<nav><ul class="pagination">';
     $config['full_tag_close'] = '</ul></nav>';
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
     $config['cur_tag_close'] = '</a></li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_link'] = '&laquo;';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_link'] = '&raquo;';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     \CI::pagination()->initialize($config);
     $data['page'] = $page;
     $data['field'] = $field;
     $data['by'] = $by;
     $this->view('customers', $data);
 }
开发者ID:thijmenvenus,项目名称:GoCart3,代码行数:35,代码来源:AdminCustomers.php

示例3: index

 public function index($code = false, $page = 0)
 {
     $pagination_base_url = site_url('search/' . $code);
     //how many products do we want to display per page?
     //this is configurable from the admin settings page.
     $per_page = config_item('products_per_page');
     \CI::load()->model('Search');
     //check to see if we have a search term
     if (!$code) {
         //if the term is in post, save it to the db and give me a reference
         $term = \CI::input()->post('term', true);
         if (empty($term)) {
             //if there is still no search term throw an error
             $data['error'] = lang('search_error');
             $this->view('search_error', $data);
             return;
         } else {
             $code = \CI::Search()->recordTerm($term);
             // no code? redirect so we can have the code in place for the sorting.
             // I know this isn't the best way...
             redirect('search/' . $code . '/' . $page);
         }
     } else {
         //if we have the md5 string, get the term
         $term = \CI::Search()->getTerm($code);
     }
     //fix for the category view page.
     $data['base_url'] = [];
     $sortArray = array('name/asc' => array('by' => 'name', 'sort' => 'ASC'), 'name/desc' => array('by' => 'name', 'sort' => 'DESC'), 'price/asc' => array('by' => 'price', 'sort' => 'ASC'), 'price/desc' => array('by' => 'price', 'sort' => 'DESC'));
     $sortBy = array('by' => false, 'sort' => false);
     if (isset($_GET['by'])) {
         if (isset($sortArray[$_GET['by']])) {
             $sortBy = $sortArray[$_GET['by']];
         }
     }
     if (empty($term)) {
         //if there is still no search term throw an error
         $this->view('search_error', $data);
         return;
     } else {
         $result = \CI::Products()->search_products($term, $per_page, $page, $sortBy['by'], $sortBy['sort']);
         $config['total_rows'] = $result['count'];
         \CI::load()->library('pagination');
         $config['base_url'] = $pagination_base_url;
         $config['uri_segment'] = 3;
         $config['per_page'] = $per_page;
         $config['num_links'] = 3;
         $config['total_rows'] = $result['count'];
         \CI::pagination()->initialize($config);
         $data['products'] = $result['products'];
         $data['category'] = (object) ['name' => str_replace('{term}', $term, lang('search_title'))];
         $this->view('categories/category', $data);
     }
 }
开发者ID:buzkall,项目名称:GoCart3,代码行数:54,代码来源:Search.php

示例4: index

 public function index($rows = 100, $order_by = "name", $sort_order = "ASC", $code = 0, $page = 0)
 {
     $data['groups'] = \CI::Customers()->get_groups();
     $data['page_title'] = lang('products');
     $data['code'] = $code;
     $term = false;
     $category_id = false;
     //get the category list for the drop menu
     $data['categories'] = \CI::Categories()->getCategoryOptionsMenu();
     $post = \CI::input()->post(null, false);
     \CI::load()->model('Search');
     if ($post) {
         $term = json_encode($post);
         $code = \CI::Search()->recordTerm($term);
         $data['code'] = $code;
     } elseif ($code) {
         $term = \CI::Search()->getTerm($code);
     }
     //store the search term
     $data['term'] = $term;
     $data['order_by'] = $order_by;
     $data['sort_order'] = $sort_order;
     $data['rows'] = $rows;
     $data['page'] = $page;
     $data['products'] = \CI::Products()->products(array('term' => $term, 'order_by' => $order_by, 'sort_order' => $sort_order, 'rows' => $rows, 'page' => $page));
     //total number of products
     $data['total'] = \CI::Products()->products(array('term' => $term, 'order_by' => $order_by, 'sort_order' => $sort_order), true);
     \CI::load()->library('pagination');
     $config['base_url'] = site_url('admin/products/' . $rows . '/' . $order_by . '/' . $sort_order . '/' . $code . '/');
     $config['total_rows'] = $data['total'];
     $config['per_page'] = $rows;
     $config['uri_segment'] = 7;
     $config['first_link'] = 'First';
     $config['first_tag_open'] = '<li>';
     $config['first_tag_close'] = '</li>';
     $config['last_link'] = 'Last';
     $config['last_tag_open'] = '<li>';
     $config['last_tag_close'] = '</li>';
     $config['full_tag_open'] = '<nav><ul class="pagination">';
     $config['full_tag_close'] = '</ul></nav>';
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
     $config['cur_tag_close'] = '</a></li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_link'] = '&laquo;';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_link'] = '&raquo;';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     \CI::pagination()->initialize($config);
     $this->view('products', $data);
 }
开发者ID:vandona,项目名称:v3,代码行数:53,代码来源:AdminProducts.php

示例5: index

 public function index($sort_by = 'order_number', $sort_order = 'desc', $code = 0, $page = 0, $rows = 100)
 {
     //if they submitted an export form do the export
     if (\CI::input()->post('submit') == 'export') {
         \CI::load()->model('Customers');
         \CI::load()->helper('download_helper');
         $post = \CI::input()->post(null, false);
         $term = (object) $post;
         $data['orders'] = \CI::Orders()->getOrders($term);
         foreach ($data['orders'] as &$o) {
             $o->items = \CI::Orders()->getItems($o->id);
         }
         force_download('orders.json', json_encode($data));
         return;
     }
     \CI::load()->helper('form');
     \CI::load()->helper('date');
     $data['message'] = \CI::session()->flashdata('message');
     $data['page_title'] = lang('orders');
     $data['code'] = $code;
     $term = false;
     $post = \CI::input()->post(null, false);
     if ($post) {
         //if the term is in post, save it to the db and give me a reference
         $term = json_encode($post);
         $code = \CI::Search()->recordTerm($term);
         $data['code'] = $code;
         //reset the term to an object for use
         $term = (object) $post;
     } elseif ($code) {
         $term = \CI::Search()->getTerm($code);
         $term = json_decode($term);
     }
     $data['term'] = $term;
     $data['orders'] = \CI::Orders()->getOrders($term, $sort_by, $sort_order, $rows, $page);
     $data['total'] = \CI::Orders()->getOrderCount($term);
     \CI::load()->library('pagination');
     $config['base_url'] = site_url('admin/orders/index/' . $sort_by . '/' . $sort_order . '/' . $code . '/');
     $config['total_rows'] = $data['total'];
     $config['per_page'] = $rows;
     $config['uri_segment'] = 7;
     $config['first_link'] = 'First';
     $config['first_tag_open'] = '<li>';
     $config['first_tag_close'] = '</li>';
     $config['last_link'] = 'Last';
     $config['last_tag_open'] = '<li>';
     $config['last_tag_close'] = '</li>';
     $config['full_tag_open'] = '<nav><ul class="pagination">';
     $config['full_tag_close'] = '</ul></nav>';
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
     $config['cur_tag_close'] = '</a></li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_link'] = '&laquo;';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_link'] = '&raquo;';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     \CI::pagination()->initialize($config);
     $data['sort_by'] = $sort_by;
     $data['sort_order'] = $sort_order;
     $this->view('orders', $data);
 }
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:64,代码来源:AdminOrders.php

示例6: lang

    echo lang('sort');
    ?>
</label>
            </div>
        </div>
    </div> 

<?php 
}
include __DIR__ . '/products.php';
?>

    <nav>
        <ul class="pagination">
            <?php 
echo CI::pagination()->create_links();
?>
        </ul>
        
    </nav>
 </div>

<?php 
include __DIR__ . '/sidebar.php';
?>
        </div>  
</div>
<!-- Main Container Ends -->
<script type="text/javascript">
$(function() {
    $("#sort").change(function () {
开发者ID:vandona,项目名称:v3,代码行数:31,代码来源:category.php

示例7: site_url

            $url .= 'ASC/';
        }
    } else {
        $url .= 'ASC/';
    }
    $url .= $page;
    echo '<th><a href="' . site_url($url) . '">' . lang($thead) . $icon . '</a></th>';
}
?>
            <th></th>
        </tr>
    </thead>

    <tbody>
        <?php 
$page_links = CI::pagination()->create_links();
if ($page_links != '') {
    ?>
        <tr><td colspan="5" style="text-align:center"><?php 
    echo $page_links;
    ?>
</td></tr>
        <?php 
}
?>
        <?php 
echo count($customers) < 1 ? '<tr><td style="text-align:center;" colspan="5">' . lang('no_customers') . '</td></tr>' : '';
foreach ($customers as $customer) {
    ?>
        <tr>
            <?php 
开发者ID:lekhangyahoo,项目名称:gonline,代码行数:31,代码来源:customers.php

示例8: index

 public function index($offset = 0)
 {
     //make sure they're logged in
     \CI::Login()->isLoggedIn('my-account');
     $data['customer'] = (array) \CI::Customers()->get_customer($this->customer->id);
     $data['addresses'] = \CI::Customers()->get_address_list($this->customer->id);
     $data['customer_addresses'] = \CI::Customers()->get_address_list($this->customer->id);
     // load other page content
     //\CI::load()->model('banner_model');
     \CI::load()->helper('directory');
     \CI::load()->helper('date');
     // paginate the orders
     \CI::load()->library('pagination');
     $config['base_url'] = site_url('my_account');
     $config['total_rows'] = \CI::Orders()->countCustomerOrders($this->customer->id);
     $config['per_page'] = '15';
     $config['first_link'] = 'First';
     $config['first_tag_open'] = '<li>';
     $config['first_tag_close'] = '</li>';
     $config['last_link'] = 'Last';
     $config['last_tag_open'] = '<li>';
     $config['last_tag_close'] = '</li>';
     $config['full_tag_open'] = '<div class="pagination"><ul>';
     $config['full_tag_close'] = '</ul></div>';
     $config['cur_tag_open'] = '<li class="active"><a href="#">';
     $config['cur_tag_close'] = '</a></li>';
     $config['num_tag_open'] = '<li>';
     $config['num_tag_close'] = '</li>';
     $config['prev_link'] = '&laquo;';
     $config['prev_tag_open'] = '<li>';
     $config['prev_tag_close'] = '</li>';
     $config['next_link'] = '&raquo;';
     $config['next_tag_open'] = '<li>';
     $config['next_tag_close'] = '</li>';
     \CI::pagination()->initialize($config);
     $data['orders_pagination'] = \CI::pagination()->create_links();
     $data['orders'] = \CI::Orders()->getCustomerOrders($this->customer->id, $offset);
     //print_r($offset);
     \CI::load()->library('form_validation');
     //        \CI::form_validation()->set_rules('company', 'lang:address_company', 'trim|max_length[128]');
     \CI::form_validation()->set_rules('firstname', 'lang:address_firstname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('lastname', 'lang:address_lastname', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email', 'lang:address_email', ['trim', 'required', 'valid_email', 'max_length[128]', ['check_email_callable', function ($str) {
         return $this->check_email($str);
     }]]);
     \CI::form_validation()->set_rules('phone', 'lang:address_phone', 'trim|required|max_length[32]');
     \CI::form_validation()->set_rules('email_subscribe', 'lang:account_newsletter_subscribe', 'trim|numeric|max_length[1]');
     if (\CI::input()->post('password') != '' || \CI::input()->post('confirm') != '') {
         \CI::form_validation()->set_rules('password', 'Password', 'required|min_length[6]|sha1');
         \CI::form_validation()->set_rules('confirm', 'Confirm Password', 'required|matches[password]');
     } else {
         \CI::form_validation()->set_rules('password', 'Password');
         \CI::form_validation()->set_rules('confirm', 'Confirm Password');
     }
     if (\CI::form_validation()->run() == FALSE) {
         $this->view('my_account', $data);
     } else {
         $customer = [];
         $customer['id'] = $this->customer->id;
         //            $customer['company'] = \CI::input()->post('company');
         $customer['firstname'] = \CI::input()->post('firstname');
         $customer['lastname'] = \CI::input()->post('lastname');
         $customer['email'] = \CI::input()->post('email');
         $customer['phone'] = \CI::input()->post('phone');
         $customer['email_subscribe'] = intval((bool) \CI::input()->post('email_subscribe'));
         if (\CI::input()->post('password') != '') {
             $customer['password'] = \CI::input()->post('password');
         }
         \GC::save_customer($this->customer);
         \CI::Customers()->save($customer);
         \CI::session()->set_flashdata('message', lang('message_account_updated'));
         redirect('my-account');
     }
 }
开发者ID:alextoshinov,项目名称:musymeshop,代码行数:74,代码来源:MyAccount.php


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