codeboy89 Posted February 7, 2010 Share Posted February 7, 2010 I am trying to remove the paging system from this snippet, it displays XML data into pages according to the $posts variable. How would I simplify this code (remove whats not needed) and show just everything on 1 page. I keep getting errors. Thanks for any help <? $file = implode('', file ("post.xml")); { // Max amount of posts on one page $posts = 6; // Count the number of posts $foo = preg_split ("<.*ponmurt.*>", $file); $count = (count($foo)-1)/2; $pages = intval(($count-1)/$posts)+1; $page = intval($_GET["page"]); // Always begin at the last page if($page < 1 || $page > $pages) $page = $pages; // Write the required page numbers if($pages > 1) { print "<p>page "; for($i=$pages; $i>=1; $i--) if($i == $page) print " <b><font size = \"3\">$i</b></font> "; else print "<a href=index.php?page=$i> $i </a>"; print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<br/></p>"; } $start = ($page-1) * ($posts*2) + 1; for($i=$start; $i<$start+$posts*2; $i+=2) print $foo[$i]; // Write the required page numbers if($pages > 1) { print "<p>page "; for($i=$pages; $i>=1; $i--) if($i == $page) print " <b><font size = \"3\">$i</b></font> "; else print "<a href=index.php?page=$i> $i </a>"; print "<hr ALIGN = CENTER WIDTH = 70%>"; print "<br/></p>"; } } ?> Quote Link to comment Share on other sites More sharing options...
ldb358 Posted February 7, 2010 Share Posted February 7, 2010 i think just having: <?php $file = implode('', file ("post.xml")); echo $file; ?> Quote Link to comment Share on other sites More sharing options...
codeboy89 Posted February 7, 2010 Author Share Posted February 7, 2010 HAHA that was easy. Thanks, that really made it simple. Quote Link to comment 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.