block

call template file, pass variables

  1. <?php
  2.  
  3. $text = theme('apply_template', $data);
  4. return $text;
  5.  
  6. function theme_apply_template($data) {
  7.     ob_start();
  8.     include path_to_theme().'/my-block.tpl.php';

Some code to search flickr for images

  1. function _optotrip_block_flickr() {
  2.   $termtext = _optotrip_get_block_context();
  3.   if ($termtext == '') {
  4.     return NULL;
  5.   }
  6.  
  7.   $starttime = microtime(TRUE);
  8.  
  9.   lightbox2_add_files();

block visibility code doesn't work in all regions

  1. if (drupal_is_front_page() == TRUE) {
  2.   return FALSE;
  3. } else {
  4.   return TRUE;
  5. }

Blog author information

  1. <?php
  2. // $Id$
  3.  
  4. /**
  5.  * @file
  6.  * Implements block for showing archives, user picture, and links for blog sidebars.
  7.  */
  8.  
  9. function blog_sidebar_block($op = 'list', $delta = 0, $edit = array()) {
Syndicate content