Solved

programmatic view: where is the pager?

Posted on 2010-08-30
4
1,338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

710 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