How do i get pagers to work?

ss84 - April 28, 2009 - 08:11

I have a list of nodes, displayed as a block. However rather than having a list of over 50 on one page, i want to split them up on several pages using a pager. What is the best way to do this?

I have tried a few pager modules but nothing seems to be working the way i want.

There are different modules

Rapha - April 28, 2009 - 10:27

There are different modules to use , Paging module , pagination and custom pagers i have tried paging and it works fine , you can even limit the number of words to show per page .I hope this helps

i have tried all 3. Custom

ss84 - April 28, 2009 - 11:02

i have tried all 3. Custom pagers seems the most appropriate, however i can only seem to display one node at a time when using the pager. I want it to display at least 10 per page. Is it possible to do this?

Hi , also on the same line ,

Rapha - April 28, 2009 - 11:51

Hi ,
also on the same line , have you tried creating views for your nodes? , you can display as a block and on the same page , (views) there is a choice of using pagination and change it to Yes , may be this might work

as far as i can see, you only

ss84 - April 28, 2009 - 12:14

as far as i can see, you only use pagers in 'page views' of views, not 'block views'.

One can use the custom code

ashiwebi - April 28, 2009 - 11:17

For example you want to display custom pager for story content type.

$type = 'story';
$status = 1;
$sql = "SELECT * FROM {node} n WHERE type = '%s' AND status = %d ORDER BY n.created DESC";
$pager_num = 0;
$result = pager_query(db_rewrite_sql($sql), 10, $pager_num, NULL, $type,$status);
while ($data = db_fetch_object($result)) {
$node = node_load($data->nid);
print node_view($node, TRUE);
}
print theme('pager', NULL, 10, $pager_num);

I hope this will help you.

When one door closes,another opens, but if we spend too much time concentrating on the closed door we don't notice the open one.

thankyou, this does work. All

ss84 - April 28, 2009 - 12:26

thankyou, this does work. All i need to do now is add a filter to display only one type of result.

If i did this throuh views i would use "Text: Type (field_type) = ___ "

I think it may be something like $node->field_type = '____'; but im not entirely sure.

 
 

Drupal is a registered trademark of Dries Buytaert.