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 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 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 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 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
Archived
This topic is now archived and is closed to further replies.