Here are the functions, enjoy!:
public static function tag($element,$attributes=array())
{
$buffer = '<' . $element;
foreach($attributes as $key => $val) {
$buffer .= ' ' . $key . '="' . $val . '"';
}
$buffer .= '/>';
return $buffer;
}
public static function blocktag($element,$attributes=array())
{
$content = $attributes['content'];
unset($attributes['content']);
$buffer = '<' . $element;
foreach($attributes as $key => $val) {
$buffer .= ' ' . $key . '="' . $val . '"';
}
$buffer .= '>';
$buffer .= $content;
$buffer .= '</' . $element . '>';
return $buffer;
}
Currently I use these in conjunction with Smarty helpers to create consistent markup across a project I'm working on. Any thoughts are appreciated!
No comments:
Post a Comment