programmatic view: where is the pager?

Hi. I have build a view that uses a pager. When I call the view (page path) the pager is shown as expected. But when rendering the view programmatically it is not:
  $view = views_get_view("interviews");
  $view->args = array("Interview");
  $view->execute('page');
  echo $view->render();

Open in new window


What am I doing wrong?
Thanx in advance
simonwidjajaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Thomas4019Connect With a Mentor Commented:
You could use this to modfiy the query, http://www.nicklewis.org/hook-views-query-alter-how-programatically-alter-views-queries, and views_embed_view accepts arguments.

Or maybe add something like this,
$view->display['default']->handler->options['display_options']['use_pager'] = TRUE;
0
 
Thomas4019Commented:
Don't programatically create the view that way. Use views_embed_view, http://thedrupalblog.com/embedding-view-drupal-6-using-views-embed-view
0
 
simonwidjajaAuthor Commented:
I need the view object before rendering, because I have to modify the query before rendering. Is there a possible way to get the pager enabled with $view->render();?
0
 
ellyjonezCommented:
Try setting the number of items per page right there before you render:

$view->set_items_per_page(20);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.