Read the CI of the pagination class did not write about the content of Ajax, but also on the forum to see the other large gods written by the extension of the paging class, the feeling is actually not necessary.
It is possible to make a small change on the basis of the existing one.
below to get to the chase:
CI has a parameter in the original zoning page class $config [Anchor_class]
This parameter is used to set the style of the paging link, so we can set it up like this:
$config [Anchor_class] = "Class=ajax_fpage";
Then, in the View section, the method of prohibiting a sticky note default action is used to get the effect of Ajax.
The code is as follows:
Copy CodeThe code is as follows:
When ajax_fpage clicks, the default action of the A tag is forbidden, and the href information is obtained, then the contents of the href are obtained using the Get method, and the DOM is updated.
Such a complete AJAX paging is implemented. You do not need to extend the original class.
The detailed PHP code is as follows:
Copy CodeThe code is as follows:
function ContentList ($id, $p =0)
{
$this->load->library (pagination);
$config [Base_url] = Site_url (qyadmin/contentlist/. $id./. $p);
$config [Total_rows] = $this->admin->content_list ($id, $p, 1);
$config [Per_page] = 5;
$config [Uri_segment] = 5;
$config [First_link] = FALSE;
$config [Last_link] = FALSE;
$config [Full_tag_open] =
;
$config [Full_tag_close] =
;
$config [Display_pages] = FALSE;
$this->load->helper (URL);
$skin _url = Base_url (). APPPATH. "Views/templates";
$config [Next_link] =;
$config [Next_tag_open] =
;
$config [Next_tag_close] =;
$config [Prev_link] =;
$config [Prev_tag_open] =
;
$config [Prev_tag_close] =;
$config [Anchor_class] = class= "Ajax_fpage";
$this->pagination->initialize ($config);
$content = $this->admin->content_list ($id, $p, 0, $config [per_page], $this->uri->segment (5));
$fpage = $this->pagination->create_links ();
$this->smarty->assign (Fpage, $fpage);
$this->smarty->assign (content, $content);
$this->smarty->view (SHOW.TPL);
}
http://www.bkjia.com/PHPjc/327887.html www.bkjia.com true http://www.bkjia.com/PHPjc/327887.html techarticle read the CI of the pagination class did not write about the content of Ajax, but also on the forum to see the other large gods written by the extension of the paging class, the feeling is actually not necessary. On the basis of the existing to do a ...