Skip to content

Instantly share code, notes, and snippets.

@connors511
Created June 5, 2012 13:28
Show Gist options
  • Save connors511/2874982 to your computer and use it in GitHub Desktop.
Save connors511/2874982 to your computer and use it in GitHub Desktop.
/** Controller_Base **/
public function set_pagination($url, $segment, $total_items, $per_page = 20)
{
Pagination::set_config(array(
'pagination_url' => $url,
'uri_segment' => $segment,
'total_items' => $total_items,
'per_page' => $per_page,
'template' => array(
'wrapper_start' => '<ul class="pager">',
'wrapper_end' => ' </ul>',
'previous_inactive_start' => '<li class="previous disabled"><a href="javascript:void(0)">',
'previous_inactive_end' => '</a></li>',
'next_inactive_start' => '<li class="next disabled"><a href="javascript:void(0)">',
'next_inactive_end' => '</a></li>',
'previous_start' => '<li class="previous">',
'previous_end' => '</li>',
'next_start' => '<li class="next">',
'next_end' => '</li>',
'active_start' => ' <li class="active disabled"><a href="javascript:void(0)">',
'active_end' => '</a></li> ',
'regular_start' => ' ',
'regular_end' => ' ',
),
));
}
/** Controller_Admin_People extends Controller_Base **/
public function action_index()
{
$this->set_pagination(Uri::create('admin/people'), 3, Model_Person::find()->count());
$data['people'] = Model_Person::find('all', array(
'limit' => \Fuel\Core\Pagination::$per_page,
'offset' => \Fuel\Core\Pagination::$offset
));
$this->template->title = "People";
$this->template->content = View::forge('admin/people/index', $data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment