Friday 15 January 2010

codeigniter - i have set $config['per_page'] = 20 but it get only two result -


I'm using the codeigniter page with 20 results per page, but when I click on paging, 3 , 4 is my controller following

  function restaurant_listing () {$ config ['base_url'] = base_url () 'admin / restaurant / restaurant_listing /'; // $ config ['base_url'] = "http: //". $ _ Server ['HTTP_HOST']; // $ config ['base_url']. = Preg_replace ('@ / + $ @', '', dirname ($ _ SERVER ['SCRIPT_NAME'])). '/'; $ Config ['total_rows'] = $ this- & gt; Restaurant_model- & gt; Record_account (); $ Config ['per_page'] = 20; $ Config ['uri_segment'] = 4; $ Config ['num_links'] = 10; $ Config ['use_page_numbers'] = true; $ Config ['cur_tag_open'] = '& lt; B & gt; '; $ Config ['cur_tag_close'] = '& lt; / B & gt; '; $ This- & gt; Pagination-> Start ($ config); $ Page = ($ this-> Yuri-> Segment (4))? $ This- & gt; Uri-> Segment (4): 0; $ Data ["result"] = $ this- & gt; Restaurant_model- & gt; Logical ($ config ["per_page"], $ page); $ Data ["link"] = $ this- & gt; Endorsement-> Create_links (); $ Data ['content'] = $ this- & gt; Load-> View ('admin / restaurant_listing', $ data, true); $ This- & gt; Load-> View ('Admin / Template', $ data); }   

in my view file

    

Here I am showing points on the page

Maybe Can I fix your code? I pagnation

admin code

  public restaurant_listing () {$ restaurant = $ this- & gt; Uri-> Segment (4); I use this code for; $ Limit_ti = 20; If (! $ Restaurant): offset_ti = 0; Other: $ offset_ti = $ restaurant; end if; $ This- & gt; Load-> Model ('restaurant_model'); // call model $ - this-> Load-> Library ('pagination'); // call library $ query = $ this- & gt; Restaurant_model- & gt; Logical ($ limit_ti, $ offset_ti); // An article $ total_page = $ this- & gt; Restaurant_model- & gt; Record_count (); // Calculation line / ** endorsement ** / $ config ['base_url'] = base_url (). 'Admin / restaurant / restaurant_listing'; $ Config ['total_rows'] = $ total_page- & gt; Num_rows (); $ Config ['per_page'] = 20; $ Config ['uri_segment'] = 4; $ Config ['num_links'] = 10; $ Config ['use_page_numbers'] = true; $ Config ['cur_tag_open'] = '& lt; B & gt; '; $ Config ['cur_tag_close'] = '& lt; / B & gt; '; $ This- & gt; Pagination-> Start ($ config); $ Data = array ('query' = & gt; $ query, 'page' = & gt; $ restaurant); $ Data ['content'] = 'admin / restaurant_listing'; $ This- & gt; Load-> View ('template', $ data); }   

Model code

  restlisting function ($ border, $ offset) {$ query = $ this- & gt; Db- & gt; Query ($ offset from $ name * * $ ID limit to ID ASC, $ limit "); Return $ query; } Function record_count () {$ query = $ this- & gt; Db- & gt; Query ("name * to * name *"); Return $ query; }   

Viewing Code

  & lt; Div class = "pagination" & gt; & Lt ;? Php echo $ this- & gt; Notation on page- & gt; Create_links); // Request Call? & Gt; & Lt; / Div & gt;    

No comments:

Post a Comment