[development] finding blocks and getting them simpler.

Earl Miles merlin at logrus.com
Mon May 15 15:39:05 UTC 2006


Khalid B wrote:
> Like Ber and Merlin, I find myself using the delta too. In 
> template.php, I find
> myself doing this:
>
> function phptemplate_get_block($block_id) {
>  $block = block_block('view', $block_id);
>  return $block['content'];
> }
>
> Then in node/page.tpl.php I do:
>
> <?php print phptemplate_get_block(6); ?>
>
> Not pretty, and has hard coded block deltas, but it works.

I actually like this. As I get more into developing for Drupal on a 
professional level and less on a hobbyist level, I've come to realize 
that on this level, database dependencies for functionality can be bad. 
You can't easily but the database in version control; but you can put 
your template.php in version control. The fewer db dependencies you 
have, the easier it is to set up test sites for various purposes.


More information about the development mailing list