0

I'm trying to programmatically include a view in a module and need to limit the number of results displayed. I tried something like this, but it doesn't work:

$view->display[$display_id]->handler->options['items_per_page'] = 2;

I also tried, but neither this worked:

$view->display[$display_id]->display_options['items_per_page'] = 2;

Any ideas? Or at least some links to Views 2 programmatically implementation?

Thanks

2

You are looking for set_items_per_page()(6), set_items_per_page()(7). Essentially the function does what you are already trying to do, but probably you are calling it on the wrong object, so use the function instead, and Views will ensure it's the right object. :)

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.