How can I check if a region has content on a particular page? I want to add some conditional coding to page.tpl.php something like:
if(["secondary_region"_has_content_on_this_page]): php print "conditional content";

The bit I can't figure out is where to call or what to use to to determine a variable for ["secondary_region"_has_content_on_this_page].

Like how with <?php if ($is_front);> we can do some things on the page conditionally only if it is the front page, I want to do some things conditionally on the page only if the 'secondary' region has content on that page.

Sorry for my English. It's my first language but I'm tired.

Thanks for your help. Love your work.

Comments

Jeff Burnz’s picture

It depends on what the "content_on_this_page" is, for example is this a block? I will assume its a block since 99% of time it is.

Blocks have visibility settings, on the actual block configuration page for each block - there is a place where you can enter various things to control where blocks show up. Now, Drupal has a core module called "PHP", this gives block configuration visibility settings an extra option - the ability to enter PHP snippets - and what snippet gets entered depends entirely on on what page or pages you are talking about.