sort of pagination
I have a poem site and I don't want the pagination where it is the numbers. Since each page is one poem, I want the numbers to be the poem titles. It will display 11 poems at a time (the surrounding ones). So the current poem will be in the middle surrounded by the next 5 and previous 5. But if it is the second poem it will have 1 in front and 9 following, same if the poem is one of the last ones. Any ideas on how to go about this or where to start? I appreciate any help I can get.
It should be simple enough to replace the numbers with the corresponding title.
Though, this (more than likely) will look rather ugly if you have poems with fairly large titles.
I changed how I'm going about it. I'm not going to list the poems around the one I'm viewing. Instead it will just list them in a select box based in 10 poem increments. Only one poem will be displayed on the page at a time, but you can select poems through the select box. So if you are viewing any of the first ten poems from the database, they will all have the same titles in the select box, but if you are viewing the 11th poem the select box will show poems 11-20. I looked at pagination tutorials, but they rely on page numbers, so not sure how to go about this. the url looks like
So it isn't passing page numbers. I guess in short I have to figure which group the poem belongs to based on poem_id, I can't seem to think of a formula though.
where 4, 5, and 6 are the id numbers from the database(or just which which record in the sequence).
then, just grab the value submitted by the browser. now you know where to start calculating your range.
I think I can figure that part, but that isn't the problem. I can't populate the select list without knowing what set of 10 I'm on. If they go to the address of the 11th poem, how do I know to show 11-20 in the select box?
limit x, 10
x coming from the select menu.
I appreciate the help, I do, but I don't think you are understanding where the problem is. When the page loads there isn't a default select case. If they go to the address of the 7th poem I'd have select options 1-10, if they go to the 13th poem, now the select options are poems 11-20. I'm trying to think of a formula for this, because in the end I'll have previous and next links, next and previous 10. Maybe there isn't a way to even do this I don't know. Beginning to think I'll have to settle for always having the current poem first and listing the following nine. Then the next link saying to start at 10 + poem_id and the previous to start at 10 - poem_id I just liked the idea of having them in groups of 10.
Where $id is the id of the poem:
Then do limit $start_display, 10
$remainder = $id % 10;
$start_display = $id - $remainder;
Something like that should work
Yes!! I think that will work, but I'd have to add 1 to start_display since 1-10 result in 0, but should be fine. Hopefully I can figure out the rest, being the previous and next links. But thanks for the help for the current problem.