public function setRegion($region, $item)
    {
        if (is_array($item)) {
            $template = array_shift($item);
            $data = $item ? reset($item) : array();
            $content = $this->render($template, $data);
        } else {
            $content = trim($item);
        }

        if ($content !== '' && isset($this->templates["region_$region"])) {

            $weight = 1;

            if (isset($this->data["region_$region"])) {
                $weight = count($this->data["region_$region"]) + 1;
            }

            $this->data["region_$region"][] = array('rendered' => $content, 'weight' => $weight);
        }
    }
public function setRegion($region, $item)
    {
        if (is_array($item)) {
            $template = array_shift($item);
            $data = $item ? reset($item) : array();
            $content = $this->render($template, $data);
        } else {
            $content = trim($item);
        }

        if ($content !== '' && isset($this->templates["region_$region"])) {

            $weight = 1;

            if (isset($this->data["region_$region"])) {
                $weight = count($this->data["region_$region"]) + 1;
            }

            $this->data["region_$region"][] = array('rendered' => $content, 'weight' => $weight);
        }
    }
public function setRegion ( $ region , $ item ) { if ( is_array ( $ item ) ) { $ template = array_shift ( $ item ) ; $ data = $ item ? reset ( $ item ) : array ( ) ; $ content = $ this -> render ( $ template , $ data ) ; } else { $ content = trim ( $ item ) ; } if ( $ content !== '' && isset ( $ this -> templates [ "region_$region" ] ) ) { $ weight = 1 ; if ( isset ( $ this -> data [ "region_$region" ] ) ) { $ weight = count ( $ this -> data [ "region_$region" ] ) + 1 ; } $ this -> data [ "region_$region" ] [ ] = array ( 'rendered' => $ content , 'weight' => $ weight ) ; } }
Adds an item to a region
@param string $region
@param string|array $item Expected array format:
first item - template, second - variables for $this->render()
Adds an item to a region