Solved

programmatic view: where is the pager?

Posted on 2010-08-30
4
1,316 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:simonwidjaja
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33558393
Don't programatically create the view that way. Use views_embed_view, http://thedrupalblog.com/embedding-view-drupal-6-using-views-embed-view
0
 

Author Comment

by:simonwidjaja
ID: 33558842
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
 
LVL 17

Accepted Solution

by:
Thomas4019 earned 250 total points
ID: 33559999
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
 

Expert Comment

by:ellyjonez
ID: 33563801
Try setting the number of items per page right there before you render:

$view->set_items_per_page(20);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages. The main difference lies of course …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now