/[drupal]/contributions/modules/flexiblock/flexiblock.module
ViewVC logotype

Diff of /contributions/modules/flexiblock/flexiblock.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2, Sat Jul 23 01:03:19 2005 UTC revision 1.3, Sat Jul 23 23:12:44 2005 UTC
# Line 1  Line 1 
1  <?php // $Id: Exp $  <?php // $Id: flexiblock.module,v 1.2 2005/07/23 01:03:19 djnz Exp $
2    
3  /**  /**
4   * @file   * @file
# Line 29  Line 29 
29   *   *
30   * Note that flexiblock is integrated into wgSmarty which makes it even simpler   * Note that flexiblock is integrated into wgSmarty which makes it even simpler
31   * to use: example 3 above becomes   * to use: example 3 above becomes
32   * {flexiblock blocks=2}   * {foreach from=$blocks.2 item=block}
  * {foreach from=$blocks item=block}  
33   *   <h3>{$block.subject}</h3>   *   <h3>{$block.subject}</h3>
34   *   {$block.content}   *   {$block.content}
35   * {/foreach}   * {/foreach}
# Line 256  function _flexiblock_set_mapping($theme, Line 255  function _flexiblock_set_mapping($theme,
255    
256  // THEME FUNCTIONS *******************************************************************  // THEME FUNCTIONS *******************************************************************
257    
   
258  // generate the html for the blocks in a region, returning an array with each element  // generate the html for the blocks in a region, returning an array with each element
259  // containing a block, including the html generated by the block.  // containing a block, including the html generated by the block.
260  // The calling function can then assemble the elements into a table or whatever.  // The calling function can then assemble the elements into a table or whatever.
261  // blocks and their output, sorted by region, are cached to avoid  // blocks and their output, sorted by region, are cached to avoid
262  // expensive  // expensive
263  function theme_flexiblock_blocks($region=0) {  function theme_flexiblock_blocks($region=FALSE) {
264  static $blocks, $regions;  static $blocks, $regions;
265    
266    // cache all available blocks    // cache all available blocks
# Line 281  static $blocks, $regions; Line 279  static $blocks, $regions;
279      }      }
280      // TODO sort by weight      // TODO sort by weight
281    }    }
282    // return the blocks for the requested region    if ( $region===FALSE ) {
283    if ( isset($regions[$region]) ) {      // return the whole array of blocks
284      return $regions[$region];      return $regions;
285    } else {    } else {
286      return array();      // return the blocks for the requested region
287        if ( isset($regions[$region]) ) {
288          return $regions[$region];
289        } else {
290          return array();
291        }
292    }    }
293  }  }
294    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.2