Mostrar Nodos con paginador


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $type = 'blog';
  2. $status = 1;
  3. $sql = "SELECT * FROM {node} n WHERE type = '%s' AND status = %d ORDER BY
  4. n.created DESC";
  5. $pager_num = 0; // This is the first pager on this page. We number it 0.
  6. $result = pager_query(db_rewrite_sql($sql), 10, $pager_num, NULL, $type,
  7. $status);
  8. while ($data = db_fetch_object($result)) {
  9. $node = node_load($data->nid);
  10. print node_view($node, TRUE);
  11. }
  12. // Add links to remaining pages of results.
  13. print theme('pager', NULL, 10, $pager_num);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.