I want to navigate through my website through page numbers assigned dynamically. e.g When I post a new topic it should be shown on the main page and the previous post should shift to "page no. 2" automatically. I want to do this without the use of a CMS.
Asked
Active
Viewed 408 times
0
-
Check this Link. This may be usefull for you. [1]: http://stackoverflow.com/a/3707457/1638375 – Prasath Albert Sep 08 '12 at 05:06
-
Looking PHP and ASP.Net samples (C#?) OR some other need client side solution (as you've also listed jQuery)? – Alexei Levenkov Sep 08 '12 at 05:14
1 Answers
1
Use a foreach loop to loop through the posts, and for each post, create a link and display the link with the number you want like so:
(assuming the $posts is an array of url's)
<?
$page_number = 1;
foreach($posts as $key) { ?>
<a href="<?= $key; ?>">Page <?= $page_number; ?></a>
<? $page_number++ ?>
<?
} ?>
Jonah Katz
- 5,082
- 15
- 65
- 90