Allan Thomas
Allan Thomas

Reputation: 3589

Drupal View - load more with ajax

I have a View (block display) listing node titles of a certain content type displaying the latest 12 published items. It displays underneath all nodes of a specific type.

What I'd like to do is be able to load the next 12 items with AJAX (I know the pager does this but I was hoping to avoid it) and also control the offset based on the node title.

I think the second request can be achieved with the row number in the query but so far I'm having trouble achieving a working script.

Upvotes: 1

Views: 5978

Answers (2)

Valentin Kantor
Valentin Kantor

Reputation: 1844

you always can call view results from Drupal API:

$results = views_get_view_result('my_view',$display, $args)

and in arguments you can pass start/end number of items, or something else, depends how you sorting your results

Upvotes: 2

John Fiala
John Fiala

Reputation: 4581

Well, instead of that work, how about selecting the mini pager? I'm pretty sure it only shows previous and next links. If it's not the exact display you want to use, you can override theme_views_mini_pager (from views/theme/theme.inc, line 636) to only show what you need.

Upvotes: 0

Related Questions