Commit 0dc124d3 by Dayle Rees

Merge pull request #1210 from franzliedke/patch-44

Definition list support (#1202)
parents 99d710a8 65d4b244
......@@ -120,6 +120,8 @@ The "mailto" method on the HTML class obfuscates the given e-mail address so it
echo HTML::ul(array('Ubuntu', 'Snow Leopard', 'Windows'));
echo HTML::dl(array('Ubuntu' => 'An operating system by Canonical', 'Windows' => 'An operating system by Microsoft'));
<a name="custom-macros"></a>
## Custom Macros
......
......@@ -349,6 +349,28 @@ class HTML {
}
/**
* 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.'</dl>';
}
/**
* Build a list of HTML attributes from an array.
*
* @param array $attributes
......
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