Welcome Guest, Not a member yet? Register   Sign In
Persistent remembering of Pagination Offset for breadcrumbs
#1

[eluser]boltsabre[/eluser]
Hi people, just wanted some input.

I've got various sections of the site that use Pagination (ie, forums, position vacant ads, image galleries, etc).

Taking Image Gallery for example, I have a breadcrumb system that looks like this:
Code:
//Breadcrumb structure when viewing an image gal category:
Home -> Image Gallery -> Category Name
//URL structure for 'Category Name':
domain.com/image-gallery/cat/v/3/30     ....or....
domain.com/controller folder/controller/method/variable (category id)/variable (pagination offset if it exists).
Categories lists all images that belong to that category in a paginated fashion (30 pics per page.

When a user clicks on an image, it loads a new controller/method/variable, but I still want to keep " Category Name" name in the breadcrumbs (like this):
Code:
//Breadcrumb structure when viewing an image:
Home -> Image Gallery -> Category Name -> Image
//URL structure for 'Category Name':
domain.com/image-gallery/cat/v/3/30     ....or....
domain.com/controller folder/controller/method/variable (category id)/variable (pagination offset if it exists).

//URL structure for 'Image':
domain.com/image-gallery/img/v/123   ...or...
domain.com/controller folder/controller/method/variable (image id)

Problem is, there is no good way to pass the "pagination offset" for my breadcrumbs for the "Category Name"... I don't want that link to always take them back to the "first page" of images for that category, but rather to the last page they were on within that category.

Has anyone tackled this before? I thought the best way would be to store it somehow, and then check for it (ie, if "pagination offset" exists include it in my breadcrumb, else make my breadcrumb default to the 'first page'.

Some things come to mind:
1. Store it in a cookie (but when to expire it?)
2. Store it as a session variable
3. Store it as flashdata (and use a persistent flashdata helper so that it stays active the entire time the user is in the image gallery, something like:
Code:
// helper function
if( isset(this->session->flashdata('pag_offset'))){
   $this->session->set_flashdata(this->session->flashdata('pag_offset'));
}

Anyone got any thoughts on the best way to handle this??? Any input would be greatly appreciated.




Theme © iAndrew 2016 - Forum software by © MyBB