src/Common.php
public function lister($tag, array $list)
    {
        $html = '';
        $class = '';
        if ($space = strpos($tag, ' ')) {
            $class = trim(substr($tag, $space));
            $tag = substr($tag, 0, $space);
        }
        foreach ($list as $key => $value) {
            if ($tag == 'dl') {
                $html .= '<dt>'.$key.'</dt>';
                $html .= '<dd>'.(is_array($value) ? implode('</dd><dd>', $value) : $value).'</dd>';
            } else {
                $html .= '<li>'.(is_array($value) ? $key.$this->lister($tag, $value) : $value).'</li>';
            }
        }

        return $this->page->tag($tag, array('class' => $class), $html);
    }
public function lister($tag, array $list)
    {
        $html = '';
        $class = '';
        if ($space = strpos($tag, ' ')) {
            $class = trim(substr($tag, $space));
            $tag = substr($tag, 0, $space);
        }
        foreach ($list as $key => $value) {
            if ($tag == 'dl') {
                $html .= '<dt>'.$key.'</dt>';
                $html .= '<dd>'.(is_array($value) ? implode('</dd><dd>', $value) : $value).'</dd>';
            } else {
                $html .= '<li>'.(is_array($value) ? $key.$this->lister($tag, $value) : $value).'</li>';
            }
        }

        return $this->page->tag($tag, array('class' => $class), $html);
    }
public function lister ( $ tag , array $ list ) { $ html = '' ; $ class = '' ; if ( $ space = strpos ( $ tag , ' ' ) ) { $ class = trim ( substr ( $ tag , $ space ) ) ; $ tag = substr ( $ tag , 0 , $ space ) ; } foreach ( $ list as $ key => $ value ) { if ( $ tag == 'dl' ) { $ html .= '<dt>' . $ key . '</dt>' ; $ html .= '<dd>' . ( is_array ( $ value ) ? implode ( '</dd><dd>' , $ value ) : $ value ) . '</dd>' ; } else { $ html .= '<li>' . ( is_array ( $ value ) ? $ key . $ this -> lister ( $ tag , $ value ) : $ value ) . '</li>' ; } } return $ this -> page -> tag ( $ tag , array ( 'class' => $ class ) , $ html ) ; }
This assists you in making Ordered, Unordered, and Definition lists. It is especially useful when you are nesting lists within lists. Your code almost looks exactly like you would expect to see it on the big screen. It would have been nice if we could have named this method 'list', but someone has taken that already.

@param string $tag Either an '**ol**' (Ordered list), '**ul**' (Unordered list), or a '**dl**' (Definition list). You can add any other classes you like (or not), but the special ones that Bootstrap has blessed us with are:

- '**list-inline**' - For an unordered list to be displayed horizontally.
- '**list-unstyled**' - For an unordered list to be unbulleted.
- '**dl-horizontal**' - For a definition to be displayed beside it's title rather than below.
@param array $list For Ordered and Unordered lists this is an ``array($li, $li, ...)``, and to nest another list just make the ``$li`` another array.

For Definition Lists this is an ``array($title => $definition, ...)``. If you have multiple ``$definition``'s, then just make ``$title`` an array of them.

@return string

@example

```php
echo $bp->lister('ol', array(
'Coffee',
'Tea' => array(
'Black tea',
'Green tea',
),
'Milk',
));

echo $bp->lister('ul list-inline', array(
'Coffee',
'Tea',
'Milk',
));

echo $bp->lister('dl dl-horizontal', array(
'Coffee' => array(
'Black hot drink',
'Caffeinated beverage',
),
'Milk' => 'White cold drink',
));
```
This assists you in making Ordered Unordered and Definition lists . It is especially useful when you are nesting lists within lists . Your code almost looks exactly like you would expect to see it on the big screen . It would have been nice if we could have named this method list but someone has taken that already .