![]() |
PHP gurus PLEASE help! (woj where are u? :-)
This simple PHP script displays html pages,
lets say that I have 10 html pages, from 1 to 10. Now this script would displays those pages from 1 to 10 (ascending) but I want it to display them from 10 to 1 (descending) What should I change in this code to make it display pages descending??? :helpme --------------------------------------------------- <?php $PAGE_START=0; $PAGE_END=10; $PAGES_PER_DAY=10; $PAGE='./{num}.shtml'; $ITEMS_PER_PAGE=10; $TEST_MODE=0; // (set between 1 and 999, or 0 for no test mode) $p=intval($_GET['p']); if($p>$PAGES_PER_DAY) die("Error"); $day=round(time()/86400); if($TEST_MODE) $day=$TEST_MODE; $d=($day%$PAGE_END); $start=$d+($p-1)*$ITEMS_PER_PAGE+$PAGE_START; $end=$start+$ITEMS_PER_PAGE; for($i=$start;$i<$end;$i++) { $page=str_replace('{num}',sprintf("haha3d",x($i)), $PAGE); if(file_exists($page)) include($page); } function x($z) { global $PAGE_END; if($z>$PAGE_END) while($z>$PAGE_END) $z=$z-$PAGE_END; return $z; } ?> ------------------------------------------------- :helpme |
This line should be changed:
for($i=$start;$i<$end;$i++) Something like: for($i=$end;$<$end;$i--) You should test it etcetera.. |
Code:
for($i=$end;$i>=$start;$i--) |
All times are GMT -7. The time now is 11:18 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123