![]() |
can you help... in Pagination I modified View and Controller function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: can you help... in Pagination I modified View and Controller function (/showthread.php?tid=71052) Pages:
1
2
|
can you help... in Pagination I modified View and Controller function - lsepolis123 - 06-29-2018 can you help... in Pagination I modified View and Controller function - I read some paragraphs from >>> https://www.codeigniter.com/userguide3/libraries/pagination.html I am getting something like > // echo $this->pagination->create_links(); // this i inserted in View ‹ First<234 I plan to apply CSS3 but the problem is these all urls the DATA is the same ARE ALL 7 ROWS ALWAYS... AND NOT 2 PER PAGE // I PUT TWO 2 TO TEST IT http://localhost/repos/.../admin/videos/all/ http://localhost/repos/.../admin/videos/all/2 http://localhost/repos/.../admin/videos/all/4 http://localhost/repos/.../admin/videos/all/6 WELL??? controller PHP Code: public function all() view PHP Code: <tr> RE: can you help... in Pagination I modified View and Controller function - jreklund - 06-30-2018 You need to add limit and offset to your SQL query. https://www.codeigniter.com/userguide3/database/query_builder.html#CI_DB_query_builder::get https://www.codeigniter.com/userguide3/database/query_builder.html#CI_DB_query_builder::limit In case you want to cheat. PHP Code: // Controller RE: can you help... in Pagination I modified View and Controller function - InsiteFX - 06-30-2018 When looking ad MySQL Select code be careful, the LIMIT offset and rows to return are backwards in CodeIgniter. RE: can you help... in Pagination I modified View and Controller function - lsepolis123 - 06-30-2018 Thank you for your assistance 1 So Model edit required... and also this 'ASC'); can be ('id', 'DESC'); .. ? // in model without error? PHP Code: // Model 2 also the file // application/config/pagination.php - Default setttings Not exist - but when created Code-igniter take use immediately everywhere Pagination exist? correct? RE: can you help... in Pagination I modified View and Controller function - lsepolis123 - 06-30-2018 $config['total_rows'] = $this->db->count_all('ads'); needed two queries the first to get how many are all videos - rows??? how ^^ this work??? https://www.codeigniter.com/userguide3/database/db_driver_reference.html?highlight=count_all#CI_DB_driver::count_all according to this ^^^ gets all rows of table but i want Only public[field public=1] videos count [exist and private[field public=0]] what to do???? RE: can you help... in Pagination I modified View and Controller function - jreklund - 07-01-2018 1. You don't need to sort it. If you already got a good natural order. But I just like to be sure. 2. It's just so you don't need to style it in every file. It it will have the same HTML if you use pagination again. 3. You can count it in PHP if you like, that's just how I did it. RE: can you help... in Pagination I modified View and Controller function - lsepolis123 - 07-01-2018 $config['total_rows'] = $this->db->count_all('videos', 'public=1'); how can count - if have pagination and limit / offset, all videos in table currently having public=1(public is a table field can be 1 or 0)...??? RE: can you help... in Pagination I modified View and Controller function - jreklund - 07-01-2018 Haven't tested it, but should work. PHP Code: $config['total_rows'] = $this->db->where('public',1)->count_all('videos'); RE: can you help... in Pagination I modified View and Controller function - lsepolis123 - 07-03-2018 PHP Code: isset($config['total_rows']) ? '' : ($config['total_rows'] = $this->db->where('public',1)->count_all('videos')) ; This is valid so as total_rows calc only if Not isset???? RE: can you help... in Pagination I modified View and Controller function - jreklund - 07-03-2018 Sure, but I don't know where you should have it set already. You only need it once in your code. |