I produced a view for my client that shows comics in ascending order, with a pager.
You can see it at http://www.3chorddorks.com/.

But the client wants the initial presentation to be the LAST page of the view, not the first.
While it would seem logical to change the sort to descending, it would change the meaning of the pager's first, last, previous and next selection links.

How do I tell Views to start at the LAST node, so if there are 10 nodes, the display should start at 10 of 10, and the previous link takes you back to 9.

Thanks in advance for any assistance.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Something like this would probably do it:

  function MYMODULE_init() {
    if ($_GET['q'] == 'path/of/view' && !isset($_GET['page'])) {
      $_GET['page'] = 99999;
    }
  }

If I remember right, Views will treat any page > the last page as the last page, so that basically will force the page to be very high (pick a number higher than you'll ever go) if the page isn't already set.

nstrassner’s picture

Mmm. Not sure where to place this code. I've over-ridden lots of view tpls, but have not injected code into views.
Would this be a part of an argument for the view, or a template injection?

merlinofchaos’s picture

No, that's a hook_init that would have to go into a custom module. You'll need to look up how to create a custom module.

nstrassner’s picture

That I can do, thank you. I just wanted to make sure the code didn't go elsewhere.
thanks for your help.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.