Remember also that you can control on what pages a block appears in the block configuration. So then the empty block. When I wanted regions to display on only specific pages, this is how a did it. If there are no blocks in a region fooregion, then $fooregion will be empty.
I did a custom mod to my php template once that took advantage of this:
In page.tpl.php
<?php if ($fooregion){?> <....The html content I want to appear when I want to display this region ....> <?php } else {?> <.... The html content I wanted to appear when I didn't have any region content to display...> <?php } ?>
Then on the block configuration page for the new menu block, I added php conditions to output this block only when on specific pages.
Does that make sense?
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Larry Garfield Sent: Wednesday, April 11, 2007 9:19 AM To: support@drupal.org Subject: Re: [support] Templating in Drupal 5.1 - the cleanest way to do it?
Yes. :-) The regions hook defines *block regions only*. $content is not a block region, and neither are $primary_links nor $secondary_links nor $help, etc. There's a lot in a page that is not block regions.
If you don't want one of those to show, just don't print them.
--Larry Garfield
On Wed, 11 Apr 2007 16:48:02 +0100, J-P Stacey jp.stacey@torchbox.com wrote:
Hi again,
Sorry to respond to my own post: this function does seem to work in populate the dropdowns at /admin/build/block :
<?php function garlandquux_regions() { return array("fooregion" => t("foo region"); // edit: added
entry
} ?>
i.e. any elements returned from the function appear on the dropdown. And that seems to work in page.tpl.php, with
<?php print $fooregion ?>
printing all blocks assigned to that region.
(I notice the HTML class of the fooregion containing div is
"block-region"
so is a region treated during templating as a special sort of block, a superblock?)
I'm definitely getting there, but the behaviour still seems a bit odd:
on the one hand there seems to be lots of variables e.g. $primary_links, $tabs, $title, $help etc. that are handed to page.tpl.php despite not being in the region list. On the other hand, $content always seems to appear on the page even if garlandquux_regions() returns an empty array. This seems a bit arbitrary - am I missing something?
Cheers, J-P -- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]