1

I use Drupal 6 and I'm trying to get number of blocks in a region. How is that possible?

2

The following query returns the number of blocks in the left region of the current theme. Replace left with your region name.

$current_theme = variable_get('theme_default', '');
$number_of_blocks = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme='%s' AND region='%s'", $current_theme, 'left'));

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.