[themes] HOw to get the box ?

Mark Fredrickson mfredrickson at ppmns.org
Tue Jan 24 16:17:56 UTC 2006


>> I wrote it for $content on a page, but I've used a similar technique to
>> break up the side bars into smaller segments.
> How?

In PHPTemplate, the $content variable passed to page.tpl.php is constructed
by passing in nodes to node.tpl.php and then concatenating the results.

The $sidebar_left and $sidebar_right variables are constructed by passing
blocks to block.tpl.php and then concatenating those results.

Therefore, if you insert a delimiter (I use HTML comments: <!-- DELIMITER
-->) into either node.tpl.php or block.tpl.php you can find it later and
break up the $content, $sidebar_left, and $sidebar_right variables using

$an_array = explode($delimiter, $the_variable_tosplit)

As an example, I've used this to create "tables" of blocks using only CSS. I
float all the blocks left using CSS, and after every third block I insert a
<div> that clears the blocks. The result is an 3 by n table of blocks (where
n = total blocks / 3).

I'll create another snippet to show how this works. I don't think I'll have
time today, but I'll see what I can do tomorrow.

For what it is worth, I don't think this addresses you earlier request, but
I thought I'd post it anyway as I think it is an interesting technique.

-M



More information about the themes mailing list