Left & Right Block Formatting in 1.5.1
- Thursday, September 11 2008 @ 03:41 pm EDT
- Contributed by: THEMike
- Views: 7,210
Geeklog Themes support the ability to define a different template for different blocks. So your "What's New" block can render differently to your Login block etc. This is done by populating an array called
$_BLOCK_TEMPLATE
in a theme's functions.php file. This array is populated with the identifiers for blocks and can set specific block header and footer templates used to format specific blocks to give them a unique look and feel.
The Professional theme that ships with Geeklog prior to 1.5.1 provides logic within functions.php to alter the template for blocks without a specific template assigned to be the left or right block template depending on which side the block has been placed by the site administrator. This changes with Geeklog 1.5.1
In 1.5.1, Geeklog still uses the same method to allow custom templates for block header and footers, however, once it has determined from the
$_BLOCK_TEMPLATE
array which template to use, it checks to see whether there is an override to that template for the side the block is on.
For example, if the
$_BLOCK_TEMPLATE
value for the admin_block
contains blockheader-list.thtml
and blockfooter-list.thtml
Geeklog will check for blockfooter-list-left.thtml
and blockheader-list-left.thtml
if the admin_block
is on the left. If those files do not exist, Geeklog will stick with blockheader-list.thtml
.
Geeklog is also intelligent enough that if your theme has already mapped admin_block
to a template that ends in a side (i.e. blockheader-list-left.thtml
then it will not perform this action.
So, it is now much easier for theme developers and site administrators to style their left and right blocks differently even if those blocks are using custom rendering templates. There is however something to note when upgrading a site to Geeklog 1.5.1. Some plugins, such as the Geeklog Forum plugin use CUSTOM_showBlocks
, and this function has changed in 1.5.1, so, when upgrading your site, make sure to copy across CUSTOM_showBlocks
from the lib-custom.php.dist
file to your own lib-custom.php
file. Unless of course you have modified CUSTOM_showBlocks
, in which case you'll need to review and understand the changes in our new function to review them for your site, or you may have some formatting issues with your blocks when running plugins such as the Geeklog Forum Plugin.