the-botman Posted November 17, 2009 Share Posted November 17, 2009 ok hi guys .. i have a text doc with 30 lines of code how do i split the text doc into 5 lines per page with a next button and prev button Quote Link to comment https://forums.phpfreaks.com/topic/181844-solved-split-a-text-doc/ Share on other sites More sharing options...
the-botman Posted November 17, 2009 Author Share Posted November 17, 2009 sorry if i asked this question all wrong but i have this text doc with 30 l9ines of text and i need to print 5 lines per page so i need to know how to do it Quote Link to comment https://forums.phpfreaks.com/topic/181844-solved-split-a-text-doc/#findComment-959067 Share on other sites More sharing options...
MadTechie Posted November 17, 2009 Share Posted November 17, 2009 something along these lines <?php $page =(empty($_GET['page']))1:$_GET['page']; //get page $page = $page * 10; // $lines = file('thefile.txt'); for($n=($page-10)$n<$page;$n++){ echo lines[$n]."<br />\n"; } echo "<a href=\"page=".$page-1."\">previous</a> | <a href=\"page=".$page+1."\">next</a>"; untested but you should get the idea Quote Link to comment https://forums.phpfreaks.com/topic/181844-solved-split-a-text-doc/#findComment-959111 Share on other sites More sharing options...
the-botman Posted November 17, 2009 Author Share Posted November 17, 2009 thanks alot yes it works 100% , i am so new to php and this forum has realy helped me alot thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/181844-solved-split-a-text-doc/#findComment-959114 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.