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.

Comments

Rapha’s picture

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

ss84’s picture

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?

Rapha’s picture

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

ss84’s picture

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

ashiwebi’s picture

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.

ss84’s picture

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.