Example #1
0
File: Z.php Project: Rogh64/outline
 /**
  * Set blocks list
  * First block is content block that drives page construction
  * order of others blocks has no effect
  *
  * 'head' is allways append to blocks if not listed
  *
  * @param array $blocks
  *    array('content','header','aside',footer');
  * @return void
  */
 public static function setBlocks($blocks)
 {
     if (!is_array($blocks)) {
         return false;
     }
     Z::$blocks = array();
     while ($b = array_shift($blocks)) {
         $b = trim(rtrim($b, '/'));
         # / not allowed in block names. Explode to take first segment
         $b = explode('/', $b);
         $b = reset($b);
         // body is not allowed as block name
         if ($b !== 'body') {
             Z::$blocks[] = $b;
         }
     }
     if (!in_array('head', Z::$blocks)) {
         Z::$blocks[] = 'head';
     }
 }