abeer Posted June 19, 2011 Share Posted June 19, 2011 by googling All the tutorials I've found on pagination always refer to paginating multiple rows out of a database. Like displaying 5 rows on each page. But I'm trying to paginate an article that is being stored in one row of the table. my table name is "page" in the table "page" there is 4 rows ------------------------------------------------------------- id | title | meta_description| meta_keywords |article -------------------------------------------------------------- 1 | title1 | meta 1| meta kewords |articles text1 bla blabla 2 | title2 | meta 2| meta kewords |articles text2 bla blabla 3 | title3 | meta 3| meta kewords |articles text3 bla blabla 4 | title4 | meta 4| meta kewords |articles text4 bla blabla so in id=1 in the article text there is a article which almost 10 page size. so i need pagination for this article can any one help? iam not understanding.. as i am very new in php Quote Link to comment https://forums.phpfreaks.com/topic/239784-long-article-pagination/ Share on other sites More sharing options...
redixx Posted June 19, 2011 Share Posted June 19, 2011 The easiest way is to make a "more page" identifier and then split the page where that is. For example: Page 1 {page} Page 2 {page} Page 3 // $text contains your article $text = explode('{page}', $text); // $text is now an array containing each of the pages // so do something like this: $page = (isset($_GET['page'])) ? $_GET['page'] : 1; // if $_GET['page'] isnt set we assign $page to 1 echo $text[$page - 1]; // we minus one because array indexes start at 0 and not 1 Quote Link to comment https://forums.phpfreaks.com/topic/239784-long-article-pagination/#findComment-1231739 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.