Manny Posted January 29, 2010 Share Posted January 29, 2010 The following post relates to an issue on this page:http://mercury.chris-mann.co.uk/burndenaces/news/In the grey divs at the top and bottom of the main content, you will see the pagination "1 ( Page 1 of 2 ) NEXT LAST".I can't work out why the "1" is there at the beginning and is there also if you click on the next link.The section of my code which the problem will probably lie with is: //10. Display drop down of news archive by monthecho ' <div class="titlestrip_sub_paging"> ', require("archivedropdown.php"),'';//11. Paginationif ($page != 1) { $prevpage = $page-1;echo ' <a href="' . $_SERVER["PHP_SELF"] . '?archive=', $archiveMonth, '&page=1">FIRST</a> <a href="' . $_SERVER["PHP_SELF"] . '?archive=', $archiveMonth, '&page=', $prevpage, '">PREV</a>';}//Next we inform the user of his current position in the sequence of available pages.if ($numrows > $rows_per_page) { echo ' ( Page ', $page, ' of ', $lastpage, ' )';}//This code will provide the links for any following pages.if ($page != $lastpage) { $nextpage = $page+1;echo ' <a href="' . $_SERVER["PHP_SELF"] . '?archive=', $archiveMonth, '&page=', $nextpage, '">NEXT</a> <a href="' . $_SERVER["PHP_SELF"] . '?archive=', $archiveMonth, '&page=', $lastpage, '">LAST</a>';}echo ' </div>'; I've checked the markup and it shows that it isn't to do with the actual pagination links, leading me to believe I've done something wrong with the require statement at the top. Here is the markup: 1 ( Page 1 of 2 ) <a href="/burndenaces/news/index.php?archive=January 2010&page=2">NEXT</a> <a href="/burndenaces/news/index.php?archive=January 2010&page=2">LAST</a> Link to comment Share on other sites More sharing options...
Err Posted January 30, 2010 Share Posted January 30, 2010 <a href="' . $_SERVER["PHP_SELF"] . '?archive=', $archiveMonth,'&page=', $prevpage,'">PREV</a>Nevermind. Disregard this post. Link to comment Share on other sites More sharing options...
Synook Posted January 30, 2010 Share Posted January 30, 2010 //10. Display drop down of news archive by monthecho ' <div class="titlestrip_sub_paging"> ', require("archivedropdown.php"),''; You're echoing the result of require("archivedropdown.php"). The result is 1 (well, it's actually true, but true is displayed as "1"). Link to comment Share on other sites More sharing options...
Manny Posted January 30, 2010 Author Share Posted January 30, 2010 OK, I changed it to this and it sorted the problem. Thanks Synook. echo ' <div class="titlestrip_sub_paging"> '; require("archivedropdown.php"); Link to comment Share on other sites More sharing options...
Synook Posted January 30, 2010 Share Posted January 30, 2010 Remember that including/requiring content is equivalent (more or less) to copying the included file's contents and pasting it into the location of the include call. This is unlike, say, invoking file_get_contents(), where the contents of the file is returned with the function and then can be manipulated and output. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 1, 2010 Share Posted February 1, 2010 You can also have include files use a return statement, similar to the way a function returns a value. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.