Reputation: 2843
Basically, I have a page where you search for a term, and the database is queried, those terms are spit out that contain the query and paginated like so:
1 2 [3] 4 5
MATTHEW 1:18
Now the birth of Jesus Christ was on this wise: When as his mother Mary was espoused to Joseph, before they came together, she was found with child of the Holy Ghost.
MATTHEW 1:21
And she shall bring forth a son, and thou shalt call his name JESUS: for he shall save his people from their sins.
MATTHEW 1:25
And knew her not till she had brought forth her firstborn son: and he called his name JESUS.
This I have completed, the below I have not:
When I click on "Matthew", it should list all the verses and chapters in "Matthew" in a new page, paginated.
When I click back(in the browser), it should go back to the previous paginated result set(above), and when I click forward (in the browser), it should show me the page of all verses and stuff from the bible section I clicked on (Matthew).
I have absolutely no idea how to even start on any of this.
Upvotes: 1
Views: 123
Reputation: 522597
What you describe is the normal behavior of the browser when you make your requests RESTful. That simply means that you contain all the information necessary to display the correct page in the request itself. Since you're talking about simple links, that means you pass the required information in the URL itself:
http://example.com/verses.php?query=knew+her+not&page=3
http://example.com/verses.php?book=matthew
In your verses.php
script you check for the existence of $_GET['query']
and/or $_GET['book']
and $_GET['page']
and retrieve and output information dynamically based in these variables. Then you just need to produce the appropriate links and the back/forward behavior is taken care of by the browser.
Upvotes: 1