6

I would like a user who has previously left a comment on a node to initially see the last page of comments while a new user (to that node) will initially see the first page of comments.
I know that the page is controlled by the pager and is set by the "page" variable in the URL ($_GET['page']). Is there a way to set this programmatically?

(Just to clarify, I am not using the Views module on this project.)

1

You can use AJAX to call a new request so you will not have the page in the URL or, if you use Views, select "Use AJAX" under the Advanced Settings, and it will enable AJAX on your pager.

| improve this answer | |
  • what if I don't want to use Ajax, but have it occur server-side (for search engines / users without javascript)? – David Barratt Jan 26 '12 at 20:11
  • You have to change the pager.inc or override its function because page by default use $_GET and you need it POST function pager_find_page($element = 0) { $page = isset($_GET['page']) ? $_GET['page'] : ''; $page_array = explode(',', $page); if (!isset($page_array[$element])) { $page_array[$element] = 0; } return (int) $page_array[$element]; } – Ahmed Jan 26 '12 at 21:47

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.