brick($tag, $html = false, $attr = array())

Creates an HTML Element (Brick object)

  • $tag (string)
    HTML tag
  • $html (string)
    HTML content
  • $attr (array)
    HTML attributes
  • return ($brick)

Example

Image element

$img = brick('img');

// adding attributes
$img->attr('src', 'http://yourdomain.com/someimage.jpg');
$img->attr('width', 300);
$img->attr('height', 200);

// adding classes
$img->addClass('image');

echo $img;

Figure

$figure = brick('figure');

// appending an image
$figure->append(function() {
  return brick('img')->attr('src', 'someimage.jpg');
});

// appending a figcaption
$figure->append(function() {
  return brick('figcaption', 'What a wonderful image');
});


echo $figure;