diff options
author | Derek Allard <derek.allard@ellislab.com> | 2010-07-05 14:11:33 +0200 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2010-07-05 14:11:33 +0200 |
commit | a0905f33eabec71e411c837967750e15d6febf19 (patch) | |
tree | 842bf73caab243bb51fd4d3169026fe9bd1b6988 | |
parent | 7770fde8733eff7024191bd8782a30ab0d1f7619 (diff) |
img() will now generate an empty string as an alt attribute if one is not provided.
-rw-r--r-- | system/helpers/html_helper.php | 6 | ||||
-rw-r--r-- | user_guide/changelog.html | 3 | ||||
-rw-r--r-- | user_guide/helpers/html_helper.html | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 4afa678a3..cd7b4ce6b 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -199,6 +199,12 @@ if ( ! function_exists('img')) $src = array('src' => $src); } + // If there is no alt attribute defined, set it to an empty string + if ( ! isset($src['alt'])) + { + $src['alt'] = ''; + } + $img = '<img'; foreach ($src as $k=>$v) diff --git a/user_guide/changelog.html b/user_guide/changelog.html index 1aa06d388..124a1cb9f 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -112,7 +112,7 @@ Hg Tag: </p> </li> <li>Helpers <ul> - <li>Added <kbd>convert_accented_characters()</kbd> function to <a href="./helpers/text_helper.html">text helper</a>.</li> + <li>Added <kbd>convert_accented_characters()</kbd> function to <a href="./helpers/text_helper.html">text helper</a>.</li> <li>Added accept-charset to the list of inserted attributes of <kbd>form_open()</kbd> in the <a href="helpers/form_helper.html">Form Helper</a>.</li> <li>Deprecated the <kbd>dohash()</kbd> function in favour of <kbd>do_hash()</kbd> for naming consistency.</li> <li>Non-backwards compatible change made to <kbd>get_dir_file_info()</kbd> in the <a href="helpers/file_helper.html">File Helper</a>. No longer recurses @@ -124,6 +124,7 @@ Hg Tag: </p> <li>Modified <kbd>prep_url()</kbd> so as to not prepend http:// if the supplied string already has a scheme.</li> <li>Modified <kbd>get_file_info</kbd> in the file helper, changing filectime() to filemtime() for dates.</li> <li>Modified <kbd>smiley_js()</kbd> to add optional third parameter to return only the javascript with no script tags.</li> + <li>The <kbd>img()</kbd> function of the <a href="./helpers/html_helper.html">HTML helper</a> will now generate an empty string as an alt attribute if one is not provided.</li> </ul> </li> <li>Other Changes diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html index a0ac8bdde..50a1c48a4 100644 --- a/user_guide/helpers/html_helper.html +++ b/user_guide/helpers/html_helper.html @@ -95,8 +95,8 @@ second the size of the heading. Example:</p> // gives <img src="http://site.com/images/picture.jpg" /></code> <p>There is an optional second parameter that is a TRUE/FALSE value that specifics if the src should have the page specified by $config['index_page'] added to the address it creates. Presumably, this would be if you were using a media controller.</p> <p><code>echo img('images/picture.jpg', TRUE);<br /> -// gives <img src="http://site.com/index.php/images/picture.jpg" /></code></p> -<p>Additionally, an associative array can be passed to the img() function for complete control over all attributes and values.</p> +// gives <img src="http://site.com/index.php/images/picture.jpg" alt="" /></code></p> +<p>Additionally, an associative array can be passed to the img() function for complete control over all attributes and values. If an alt attribute is not provided, CodeIgniter will generate an empty string.</p> <p><code> $image_properties = array(<br /> 'src' => 'images/picture.jpg',<br /> 'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',<br /> |