I'm aware of how to change the number of nodes displayed on the front page. My question is whether there is a variable in Drupal, or a way of calculating the numbers of nodes displayed per page of front page content?

I've got a block module that prints out information according to the nodes that are being rendered in the main content area of the front page, so it needs a list of the nodes. If there is an array of nodes that can be accessed that would also work, but I can't find information on that, so I've been trying to calculate the items per page, but merely dividing the total number of front page nodes divided by the number of pages gives inconsistent results of course.

I could of course hardcode the number, but I'd prefer a programatic way for determining this value.


This value can be set in the site information admin settings form.

$count = variable_get('default_nodes_main', 10);

This should work for both Drupal 5, 6 and 7.

  • Big thanks. I was thinking I could probably just do a DB query, but this is a much simple and elegant approach. – Brian Crawford Sep 13 '13 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.