diff --git a/laravel/documentation/views/html.md b/laravel/documentation/views/html.md index 5bcaa389..aabe244d 100644 --- a/laravel/documentation/views/html.md +++ b/laravel/documentation/views/html.md @@ -119,6 +119,8 @@ #### Creating lists from an array of items: echo HTML::ol(array('Get Peanut Butter', 'Get Chocolate', 'Feast')); echo HTML::ul(array('Ubuntu', 'Snow Leopard', 'Windows')); + + echo HTML::dl(array('Ubuntu' => 'An operating system by Canonical', 'Windows' => 'An operating system by Microsoft')); ## Custom Macros diff --git a/laravel/html.php b/laravel/html.php index fd5bf82e..211e4022 100644 --- a/laravel/html.php +++ b/laravel/html.php @@ -347,6 +347,28 @@ private static function listing($type, $list, $attributes = array()) 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 .= '