[geeklog-devel] The Mysterious Case of the Double Blocks (was 1.5.1 - what's left to do?)

Michael Jervis mjervis at gmail.com
Sun Aug 17 06:49:03 EDT 2008


> The current naming convention, block[header|footer]{-something}.thtml
> looks more logical to me (and makes it easier to find template files
> that belong together).

I liked having left and right together in the file list, but I can see
how having all the block templates together is actually more useful.

> Aren't you building the filenames from the given parameters anyway? So
> the function is in control of the filenames and shouldn't have to do any
> stripping or trimming. Or am I missing something?

functions.php in professional:

$nrows = DB_numRows($result);
for ($i = 0; $i < $nrows; $i++) {
    $A = DB_fetchArray($result);
        if ($A['onleft'] == 1) {
            $_BLOCK_TEMPLATE[$A['name']] =
'blockheader-left.thtml,blockfooter-left.thtml';
        } else {
            $_BLOCK_TEMPLATE[$A['name']] =
'blockheader-right.thtml,blockfooter-right.thtml';
    }
}

$_BLOCK_TEMPLATE['_msg_block'] =
'blockheader-message.thtml,blockfooter-message.thtml';

Followed by many more hard-coded entries in $_BLOCK_TEMPLATE to give
particular blocks a specific format.

Then COM_getBlockTemplate just looks them up, if there isn't an entry
for a named block, fails over to blockheader.thtml.

SO...

The change will have to strip the .thtml off the end of the template
from teh array, look for -left or -right and if not test for it. Not
exactly rocket science, but at least a few lines of code more than my
solution ;-)

Still, it keeps them together. I'll go with that. STill saves that
database load and loop in professional's functions.php as it will just
default to looking for blockheader[-left|-right].thtml.

Mike



More information about the geeklog-devel mailing list