0

I have a content type called as People that lists all users on the site.

Next i have a view PeopleList that lists the content type People in a list form and has a pager.

I have customized the pager to look like a Load More button that adds the next set of People and the list grows on the same page. Now when i view a node and hit browser's back button the pager comes to first state only that is on first page .

For example- If i have 30 people listed and i hit load more next 30 add up and now if i view node say number 51 and hit browser's back button the pager comes to its default state that is first 30 people listing only.

How to solve this issue. What should i need to incorporate to get this sorted. Please guide.

1

It sounds like you wrote most of this yourself, or with some heavy work in Views maybe -- either way Good job! :)

You can solve your problem by saving the pager value into the users $_SESSION data. Every time they the pager page adds a key the querystring http://www.yoursite.com/page&page=2 you can check the querystring for the page key and save its value to the users session. Eg,

if (isset($_GET['page']) && intval($_GET['page'], 10)) {
  $_SESSION['your_custom_pager_index'] = $_GET['page'];
} else {
  $_SESSION['your_custom_pager_index'] = 1;
}

Then you can check for $_SESSION['your_custom_pager_index'] in your list form pager code to offset by whatever amount based on your index value.

| improve this answer | |
0

The simplest way to solve this issue is probably to abandon your home-made content type "People" and customized pager, and to use the Views module to produce the list of users. The Views module UI lets you add a pager to the module that works the way one expects a pager to work.

You can still customize the look of the pager etc. by overriding the template(s) involved. However, I think this problem is best solved by relying on the built-in functionality of Views listing the built-in user object.

| improve this answer | |
  • yes i have simply customized the normal view pager by overriding templates in my custom theme, however still looking for an answer. – Prerit Mohan Apr 27 '13 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.