User Tools

Site Tools


bigace:developer:viewhelper:widgets

Table of Contents

widgets()

The widgets ViewHelper fetches Widgets for a given Item.

→ Since BIGACE 3.0

Attributes

  • $item - (required, Bigace_Item)

The $item to fetch Widgets for.

  • $name - (optional, String)

The $name of the Widget column. (Default: null → ignore if you are using only one column).

Returns an array of Widget obbjects, see API.

Example

This example shows to load and display widgets in a normal (one column) layout.

<?php 
/*
Widgets: sidebar
*/
 
  $widgets = $this->widgets($this->MENU);
  foreach($widgets as $widget) {
    echo '<h2>' . $widget->getTitle() . '</h2>';
    echo $widget->getHtml();
  }
?>

This example shows support for multiple widget columns.

<?php 
/*
Widgets: left,right
*/
 
  echo '<div id="left">';
  $widgets = $this->widgets($this->MENU, 'left');
  foreach($widgets as $widget) {
    echo '<h2>' . $widget->getTitle() . '</h2>';
    echo $widget->getHtml();
  }
  echo '</div>';
 
  echo '<div id="right">';
  $widgets = $this->widgets($this->MENU, 'right');
  foreach($widgets as $widget) {
    echo '<h2>' . $widget->getTitle() . '</h2>';
    echo $widget->getHtml();
  }
  echo '</div>';
?>  

See also

bigace/developer/viewhelper/widgets.txt · Last modified: 2011/02/22 18:17 by kevin