Commit c7763a23 authored by Franz Liedke's avatar Franz Liedke

Add definition list helper to HTML class.

parent 38562d50
......@@ -348,6 +348,28 @@ class HTML {
return '<'.$type.static::attributes($attributes).'>'.$html.'</'.$type.'>';
}
/**
* Generate a definition list.
*
* @param array $list
* @param array $attributes
* @return string
*/
public static function dl($list, $attributes = array())
{
$html = '';
if (count($list) == 0) return $html;
foreach ($list as $term => $description)
{
$html .= '<dt>'.static::entities($term).'</dt>';
$html .= '<dd>'.static::entities($description).'</dd>';
}
return '<dl'.static::attributes($attributes).'>'.$html.'</'.$type.'>';
}
/**
* Build a list of HTML attributes from an array.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment