/** * Create an image tag. * * i('foo.png', array('alt' => 'Hello')) * i('bar.png', '#my-image') * i('baz.gif', '#my-image.my-class', array('width' => 500)) */ function i($src, $options_or_selector = array(), $options = array()) { $options += parse_simple_selector($options_or_selector); $options['src'] = url_for_image($src); $options += array('alt' => ''); return empty_tag('img', $options); }
/** * content helper, accepts a function argument for $content */ public static function c($name, $content, $attributes = array()) { $chunks = parse_simple_selector($name); if (isset($chunks['name'])) { $name = $chunks['name']; unset($chunks['name']); } else { $name = 'div'; } $attributes += $chunks; return self::tag($name, is_callable($content) ? $content() : $content, $attributes); }