0

I'm trying to build an infinite scroll with views using a custom ajax callback function, every view has only 1 node displayed. What I would like to do is use the offset to load the correct view. To be clear, I already tried views infinite scroll and infinite scroll modules and for various reasons I cannot use them.

What I got so far is this:

$view = views_get_view('frontpage');
$view->set_items_per_page(1);
$view->set_offset($offset);

$view->execute_display();

This gives me back the right markup with the right node.

My question is, what if I want to process the node loaded in the view before getting back the markup? Is this possible? I've looked through the view API multiple time without finding something suitable.

1 Answer 1

0

You can display anything using Views: Nodes, users, comments, fields. Drawback is - Views object does not particularly care about the type of data. As long as handlers can process it, it works. But that means it cannot really expose methods related to the kind of data displayed. It might be possible to hack around it, but it's not the way it was designed to work.

2
  • Is it possible then (and good practice of course) to manually pass the node to the view? To make myself clear, what if I query the node manually, do my processing stuff, and then pass the node to the view?
    – Ende Neu
    Commented Aug 22, 2013 at 14:31
  • @EndeNeu Views are just a really complicated query builder, so I doubt it's possible that way. You can add additional node display and use it exclusively in views, styling it as you need, or use "fields" display with templates of your choosing, but that's about it.
    – Mołot
    Commented Aug 22, 2013 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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