[development] finding blocks and getting them simpler.

Khalid B kb at 2bits.com
Mon May 15 16:47:31 UTC 2006


On 5/15/06, Earl Miles <merlin at logrus.com> wrote:
> 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.

But, 6 is not portable to other sites. In another site it maybe 1 or 22.
So not sure what having it under version control would achieve.

If it is:
<?php print $region_adsense_top; ?>
Or
<?php print $region_announce; ?>

It is less code, and more descriptive ...

> 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.

You can use mysqldump without the extended insert option, and put
that under your favorite version control system. You may want to delete
the rows from things like cache, accesslog, and watchdog before you
do so.

The site content is now versioned for you ... sort of ...


More information about the development mailing list