Here are some of my business code to share with you: Here are two methods in controller:
Here is some of my business code to share with you:
Here are two methods in controller:
// Pagination settings
Function page_config ($ count, $ add ){
$ Config ['base _ url'] = $ add; // you can specify the base address.
$ Config ['uri _ segment '] = 3; // you can specify the offset of the segment in the url used to pass the page splitter.
$ Config ['total _ rows '] = $ count;
$ Config ['per _ page'] = 10; // The number of data displayed on each page
// $ Config ['first _ link'] = 'homepage ';
// $ Config ['last _ link'] = 'Last page ';
$ Config ['next _ link'] = 'next page> ';
$ Config ['prev _ link'] =' <上一页';
Return $ config;
} // Business ticket list
Function market_list (){
$ Data ['action _ market '] = $ this-> user_action ()-> action_market;
$ This-> session ();
$ Add = 'market/market_list ';
$ Count = $ this-> db-> count_all ('market _ sig '); // Obtain the quantity
$ Config = $ this-> page_config ($ count, $ add );
$ This-> pagination-> initialize ($ config); // sets the complete page splitter.
$ This-> load-> library ('table'); // load a table class
$ Data ['list'] = $ this-> Mmarket-> market_sig ($ config ['per _ page'], $ this-> uri-> segment (3 )); // Here we can see the model class of the market.
$ This-> load-> view ('market/market_list ', $ data );
}
The methods in the model class are as follows:
// List
Function market_sig ($ n, $ o ){
If ($ o = '') {$ o = 0 ;}
$ Result = $ this-> db-> query ("select * from market_sig where del! = 0 order by sig_time desc limit $ o, $ n ");
$ Re = $ result-> result ();
Return $ re;
}
In the view, you only need to write it like this:
Pagination-> create_links ();?>
The code is for your reference. if you have any questions, please contact me.