diff options
-rw-r--r-- | system/helpers/html_helper.php | 5 | ||||
-rw-r--r-- | user_guide/changelog.html | 5 | ||||
-rw-r--r-- | user_guide/helpers/html_helper.html | 5 |
3 files changed, 13 insertions, 2 deletions
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index c6103ab6f..a29204391 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -40,9 +40,10 @@ */ if ( ! function_exists('heading')) { - function heading($data = '', $h = '1') + function heading($data = '', $h = '1', $attributes = '') { - return "<h".$h.">".$data."</h".$h.">"; + $attributes = ($attributes != '') ? ' '.$attributes : $attributes; + return "<h".$h.$attributes.">".$data."</h".$h.">"; } } diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 0ebe74ae6..0afc5b822 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -68,6 +68,11 @@ Change Log <li></li> </ul> </li> + <li>Helpers + <ul> + <li>Added an optional third parameter to <samp>heading()</samp> which allows adding html attributes to the rendered heading tag.</li> + </ul> + </li> </ul> <h3>Bug fixes for 2.0.3</h3> diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html index 1a0529f7b..308013d51 100644 --- a/user_guide/helpers/html_helper.html +++ b/user_guide/helpers/html_helper.html @@ -89,6 +89,11 @@ second the size of the heading. Example:</p> <code>echo heading('Welcome!', 3);</code> <p>The above would produce: <h3>Welcome!</h3></p> +<p>Additionally, in order to add attributes to the heading tag such as HTML classes, ids or inline styles, a third parameter is available.</p> +<code>echo heading('Welcome!', 3, 'class="pink"')</code> +<p>The above code produces: <h3 class="pink">Welcome!<<h3></p> + + <h2><a name="img"></a>img()</h2> <p>Lets you create HTML <img /> tags. The first parameter contains the image source. Example:</p> <code>echo img('images/picture.jpg');<br /> |