Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Suggestions on Pagination?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33714
    stevendeeds
    Member

    Hey doods, I’m not really sure how to accomplish my goal on this one.

    Here’s the website I’m working on:
    http://lostimagesofww2.com/photos/places/louisiana-maneuvers.php

    This section of the site, is following a WW2 soldier (amateur shutterbug) through his travels.
    The sidebar with the links shows the places in order of his travels.

    At the bottom of each ‘place’ page, I would like their to be dynamic links that functions like: “ONWARD TO $next_place” and “BACK TO $prev_place”. Somehow it needs to _GET the current page, and then check that information against a list of links, determine the current pages position in that list, and output the item before and after it.

    Obviously, these links can’t be sorted alpha or numerically, and I want a ‘dynamic’ solution that would be graceful if another ‘place’ is discovered, and added somewhere into the list. This will probably have to be database driven or function driven, but any ideas on structure and manipulation of data so that it does what i want?

    This is way over my head. Any help would be great.

    #84248
    ddliu
    Member

    First of all, the list of data should be sortable(e.g. by related time, or by place, or sorted by order which is maintained manually).

    Take following list for example:


    TABLE "links":
    #id #time #place #disp_order
    1 ... New York 3
    2 ... Devizes 5
    3 ... London 1

    So when showing entry #2, it will be:

    New York …

    << Prev is London Next is Devizes >>

    For data retrieving:
    #1. Get data entry of #1 New York($entry)
    #2. Get prev entry:


    SELECT id, place FROM links WHERE disp_order < $entry ORDER BY disp_order LIMIT 1

    #3. Get next entry:


    SELECT id, place FROM links WHERE disp_order > $entry ORDER BY disp_order DESC LIMIT 1

    Hope it helps.

    #84265
    stevendeeds
    Member

    Hey @ddliu , first of all, thanks for your time so far. I like that table structure, I think that will work well, but my question is, at what point in this process does php determine what page you’re on?

    #84267
    ddliu
    Member

    You can pass id of the entry to PHP, and php will get the entry by id, and then prev entry and next entry.

    #84269
    stevendeeds
    Member

    @ddliu So I still have to physically tell php what page it’s on?

    #84284
    ddliu
    Member

    Sorry I don’t quite understand your problem.

    Of cause in the page where you show the place, you should know it’s ID or something else so that you can fetch the place entry from DB.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.