# Container

## This is the base class for all of phpHtmlLib

by Walter A. Boring IV
mailto:waboring@3gstech.com
© September 2005, Walter A. Boring IV
(phpHtmlLib 2.5.4)

## Description

This class is nothing more then a container widget. It lets you push data into it, and it will render each item indented properly so it works with the rest of the libs.

This is helpfull when you have a function that wants to return multiple Tag Objects or widgets. Just wrap them in this container and they will all get rendered with the current indentation level.

## Example

      $c = container('this is a', html_b('test') );
      $c->add( html_br() );
      print $c->render();

## Constructor call

This lets you pass in data that you want automatically added to the container. You can add as man items in the call the constructor. Then you can use the add() method to add more items later.

    $c = container('this is a', html_b('test'));

## add Method

This lets you add new data to the container. You can pass in strings, integers and other Container child objects that implement the render() method.

    $c = container();
    $c->add('testing', 1, 2, 3);

The output:

    testing
    1
    2
    3

## Collapse

This method is used to force the output to exist on 1 line, instead of a newline for every element added.

    $c = container();
    $c->set_collapse();
    $c->add('testing', 1, 2, 3);

The output:

    testing123

Documentation generated on Thu, 1 Sep 2005 17:05:08 -0700 by phpDocumentor 1.3.0RC3