本文整理汇总了PHP中create_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP create_pagination函数的具体用法?PHP create_pagination怎么用?PHP create_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
public function post($news_id, $p = 0)
{
$category = $this->db->query("SELECT * FROM td_news WHERE news_id = '" . $news_id . "'")->result_array();
$category['p_c_name'] = $this->db->query("SELECT * FROM td_category WHERE id = '" . $category[0]['category'] . "'")->result_array();
$category['menus'] = $this->db->query('SELECT * FROM td_category LIMIT 7')->result_array();
$category['top_banner'] = $this->db->query('SELECT * FROM td_sponsor WHERE sp_pos = "top"')->result_array();
$category['current_news'] = $this->db->query('SELECT * FROM td_news LIMIT 20')->result_array();
$category['breking_news'] = $this->db->query('SELECT * FROM td_news WHERE slider = 1')->result_array();
$category['previous'] = $this->db->query('select * from td_news where news_id = (select max(news_id) from td_news where news_id < "' . $news_id . '")')->result_array();
$category['next'] = $this->db->query('select * from td_news where news_id = (select min(news_id) from td_news where news_id > "' . $news_id . '")')->result_array();
$limit = 6;
//how many items to show per page
$page = $p;
if ($page) {
$start = ($page - 1) * $limit;
} else {
$start = 0;
}
$category['post_data'] = $this->db->query("select * from td_news where news_id = '" . $news_id . "' LIMIT {$start}, {$limit} ")->result_array();
$total_pages = $this->db->query("select * from td_news where news_id = '" . $news_id . "'")->num_rows();
require_once APPPATH . "libraries/pagination.php";
$category['res'] = create_pagination('td_news', base_url() . 'index.php/gallery/galleryImages/' . $news_id, $limit, $page, $total_pages);
//$this->load->view('table',$result);
$category['total_item'] = $total_pages;
$this->load->view('post', $category);
}
示例2: index
public function index($type = 'na', $value = 'na', $start = 0)
{
// Check for btnAction
if ($action = $this->input->post('btnAction')) {
$this->{$action}();
}
// Get filter if set
if ($type != 'na' and $value != 'na') {
$filter = array($type => $value);
$products = $this->products_m->get_products($filter, $start, $this->perpage);
$this->data->{$type} = $value;
} else {
$products = $this->products_m->get_products(array(), $start, $this->perpage);
}
// Build product data
foreach ($products as &$product) {
$product = $this->products_m->get_product($product['id']);
}
// Assign variables
$this->data->products = $products;
$this->data->count = $this->products_m->get_products(isset($filter) ? $filter : array(), 0, 0);
$this->data->count = $this->data->count ? count($this->data->count) : 0;
$this->data->pagination = create_pagination('/admin/firesale/products/' . ($type != 'na' ? $type : 'na') . '/' . ($value != 'na' ? $value : 'na') . '/', $this->data->count, $this->perpage, 6);
$this->data->categories = array(0 => lang('firesale:label_filtersel')) + $this->categories_m->dropdown_values();
// Add page data
$this->template->title(lang('firesale:title') . ' ' . lang('firesale:sections:products'))->set($this->data);
// Fire events
Events::trigger('page_build', $this->template);
// Build page
$this->template->build('admin/products/index');
}
示例3: view
/**
* View
*
* Loads the topic and displays it with all replies.
*
* @param int $topic_id Id of the topic to display
* @param int $offset The offset used for pagination
* @access public
* @return void
*/
public function view($topic_id, $offset = 0)
{
// Update view counter
$this->forum_posts_m->add_topic_view($topic_id);
// Pagination junk
$per_page = '10';
$pagination = create_pagination('forums/topics/view/' . $topic_id, $this->forum_posts_m->count_posts_in_topic($topic_id), $per_page, 5);
if ($offset < $per_page) {
$offset = 0;
}
$pagination['offset'] = $offset;
// End Pagination
// If topic or forum do not exist then 404
$topic = $this->forum_posts_m->get($topic_id) or show_404();
$forum = $this->forums_m->get($topic->forum_id) or show_404();
// Get a list of posts which have no parents (topics) in this forum
$topic->posts = $this->forum_posts_m->get_posts_by_topic($topic_id, $offset, $per_page);
foreach ($topic->posts as &$post) {
$post->author = $this->forum_posts_m->author_info($post->author_id);
$post->author->post_count = $this->forum_posts_m->count_user_posts($post->author_id);
}
$this->data->topic =& $topic;
$this->data->forum =& $forum;
$this->data->pagination =& $pagination;
// Create page
$this->template->title($topic->title);
$this->template->set_breadcrumb($forum->title, 'forums/view/' . $forum->id);
$this->template->set_breadcrumb($topic->title);
$this->template->build('posts/view', $this->data);
}
示例4: index
/**
* Show all created alert posts
*/
public function index()
{
//set the base/default where clause
$base_where = array('show_future' => true, 'status' => 'all');
//add post values to base_where if f_module is posted
/*if ($this->input->post('f_category'))
{
$base_where['category'] = $this->input->post('f_category');
}*/
if ($this->input->post('f_status')) {
$base_where['status'] = $this->input->post('f_status');
}
if ($this->input->post('f_keywords')) {
$base_where['keywords'] = $this->input->post('f_keywords');
}
// Create pagination links
$total_rows = $this->alert_m->count_by($base_where);
$pagination = create_pagination('admin/alert/index', $total_rows);
// Using this data, get the relevant results
$alert = $this->alert_m->limit($pagination['limit'], $pagination['offset'])->get_many_by($base_where);
//do we need to unset the layout because the request is ajax?
$this->input->is_ajax_request() and $this->template->set_layout(false);
$this->template->title($this->module_details['name'])->append_js('admin/filter.js')->set_partial('filters', 'admin/partials/filters')->set('pagination', $pagination)->set('alert', $alert);
$this->input->is_ajax_request() ? $this->template->build('admin/tables/posts') : $this->template->build('admin/index');
}
示例5: index
/**
* Entries Index
*
* @access private
* @return void
*/
public function index()
{
$offset_uri = 6;
$pagination_uri = 'admin/streams/entries/index/' . $this->data->stream->id;
// -------------------------------------
// Get fields for headers and add specials
// -------------------------------------
$this->data->stream_fields = $this->streams_m->get_stream_fields($this->data->stream_id);
$this->data->stream_fields->id->field_name = lang('streams.id');
$this->data->stream_fields->created->field_name = lang('streams.created_date');
$this->data->stream_fields->updated->field_name = lang('streams.updated_date');
$this->data->stream_fields->created_by->field_name = lang('streams.created_by');
$offset = $this->uri->segment($offset_uri, 0);
if ($this->data->stream->sorting == 'custom') {
// We need some variables to use in the sort. I guess.
$this->template->append_metadata('<script type="text/javascript" language="javascript">var stream_id=' . $this->data->stream->id . ';var stream_offset=' . $offset . ';</script>');
// We want to sort this shit
$this->template->append_metadata(js('entry_sorting.js', 'streams'));
// Comeon' Livequery! You're goin' in!
$this->template->append_metadata(js('jquery.livequery.js', 'streams'));
}
// -------------------------------------
// Get data
// -------------------------------------
$this->db->limit($this->settings->item('records_per_page'), $offset);
$this->data->data = $this->streams_m->get_stream_data($this->data->stream, $this->data->stream_fields, $this->settings->item('records_per_page'), $this->uri->segment($offset_uri));
// -------------------------------------
// Pagination
// -------------------------------------
$this->data->pagination = create_pagination($pagination_uri, $this->db->count_all(STR_PRE . $this->data->stream->stream_slug), $this->settings->item('records_per_page'), 6);
// -------------------------------------
// Build Pages
// -------------------------------------
$this->template->build('admin/entries/index', $this->data);
}
示例6: inactive
/**
* Show all inactive users
* @access public
* @return voud
*/
public function inactive()
{
$this->data->pagination = create_pagination('admin/users/inactive', $this->data->inactive_user_count);
$this->data->users = $this->users_m->limit($this->data->pagination['limit'])->order_by('users.id', 'desc')->get_many_by('active', 0);
// Render the view
$this->template->title($this->module_details['name'], lang('user_inactive_title'))->build('admin/index', $this->data);
}
示例7: index
/**
* List all users
*/
public function index()
{
$base_where = array('active' => 0);
// ---------------------------
// User Filters
// ---------------------------
// Determine active param
$base_where['active'] = $this->input->post('f_module') ? (int) $this->input->post('f_active') : $base_where['active'];
// Determine group param
$base_where = $this->input->post('f_group') ? $base_where + array('group_id' => (int) $this->input->post('f_group')) : $base_where;
// Keyphrase param
$base_where = $this->input->post('f_keywords') ? $base_where + array('name' => $this->input->post('f_keywords')) : $base_where;
// Create pagination links
$pagination = create_pagination('admin/users/index', $this->user_m->count_by($base_where));
//Skip admin
$skip_admin = $this->current_user->group != 'admin' ? 'admin' : '';
// Using this data, get the relevant results
$users = $this->user_m->order_by('active', 'desc')->where_not_in('name', $skip_admin)->limit($pagination['limit'])->get_many_by($base_where);
// Unset the layout if we have an ajax request
if ($this->input->is_ajax_request()) {
$this->template->set_layout(FALSE);
}
// Render the view
$this->template->title($this->module_details['name'])->set('pagination', $pagination)->set('users', $users)->set_partial('filters', 'admin/partials/filters')->append_js('admin/filter.js');
$this->input->is_ajax_request() ? $this->template->build('admin/tables/users') : $this->template->build('admin/index');
}
示例8: index
public function index()
{
$total_rows = $this->admin_m->getData('users')->num_rows();
$pagination = create_pagination(ADMIN_URL . '/user/', $total_rows, '', 3);
$data = $this->admin_m->getData('users', array(), $pagination)->result_array();
$this->template->title('Mexious Photography', 'User')->set('data', $data)->set('pagination', $pagination)->build('admin/user_index');
}
示例9: index
public function index()
{
$rows = $this->portfolio_m->count_all();
$pagination = create_pagination('admin/portfolio/index', $rows);
$projects = $this->portfolio_m->list_projects();
$this->template->title($this->module_details['name'])->set('pagination', $pagination)->set('projects', $projects)->build('admin/index');
}
示例10: index
public function index()
{
$total_rows = $this->blog_m->getDataPost()->num_rows();
$pagination = create_pagination(ADMIN_URL . '/blog/', $total_rows, '', 3);
$data = $this->blog_m->getDataPost(array(), $pagination)->result_array();
$this->template->title('Mexious Photography', 'Blog')->set('data', $data)->set('pagination', $pagination)->build('admin/blog_index');
}
示例11: view
function view($forum_id = 0, $offset = 0)
{
// Check if forum exists, if not 404
($forum = $this->forums_m->get($forum_id)) || show_404();
// Pagination junk
$per_page = '25';
$pagination = create_pagination('forums/view/' . $forum_id, $this->forum_posts_m->count_topics_in_forum($forum_id), $per_page, 4);
if ($offset < $per_page) {
$offset = 0;
}
$pagination['offset'] = $offset;
// End Pagination
// Get all topics for this forum
$forum->topics = $this->forum_posts_m->get_topics_by_forum($forum_id, $offset, $per_page);
// Get a list of posts which have no parents (topics) in this forum
foreach ($forum->topics as &$topic) {
$topic->post_count = $this->forum_posts_m->count_posts_in_topic($topic->id);
$topic->last_post = $this->forum_posts_m->last_topic_post($topic->id);
if (!empty($topic->last_post)) {
$topic->last_post->author = $this->forum_posts_m->author_info($topic->last_post->author_id);
}
}
$this->data->forum =& $forum;
$this->data->pagination = $pagination;
$this->template->set_breadcrumb('Forums', 'forums');
$this->template->set_breadcrumb($forum->title);
$this->template->build('forum/view', $this->data);
}
示例12: inactive
function inactive()
{
$total_rows = $this->users_m->countUsers(array('active' => 1));
$this->data->pagination = create_pagination('admin/users/inactive', $total_rows);
$inactive_criteria = array('active' => 0, 'limit' => $this->data->pagination['limit'], 'order' => 'id desc');
$this->data->users = $this->users_m->getUsers($inactive_criteria);
$this->layout->create('admin/inactive', $this->data);
}
示例13: index
/**
* List all variables
*/
public function index()
{
// Create pagination links
$this->template->pagination = create_pagination('admin/variables/index', $this->variables_m->count_all());
// Using this data, get the relevant results
$this->template->variables = $this->variables_m->limit($this->template->pagination['limit'])->get_all();
$this->template->title($this->module_details['name'])->append_js('module::variables.js')->build('admin/index');
}
示例14: index
/**
* List all redirects
* @access public
* @return void
*/
public function index()
{
// Create pagination links
$total_rows = $this->redirect_m->count_all();
$this->data->pagination = create_pagination('admin/redirects/index', $total_rows);
// Using this data, get the relevant results
$this->data->redirects = $this->redirect_m->order_by('`from`')->limit($this->data->pagination['limit'])->get_all();
$this->template->build('admin/index', $this->data);
}
示例15: index
function index()
{
// Create pagination links
$total_rows = $this->news_m->count_by(array('show_future' => TRUE, 'status' => 'all'));
$this->data->pagination = create_pagination('admin/news/index', $total_rows);
// Using this data, get the relevant results
$this->data->news = $this->news_m->limit($this->data->pagination['limit'])->get_many_by(array('show_future' => TRUE, 'status' => 'all'));
$this->template->build('admin/index', $this->data);
}