diff options
Diffstat (limited to 'user_guide/libraries/language.html')
-rw-r--r-- | user_guide/libraries/language.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html index eff7d32a5..aa0774327 100644 --- a/user_guide/libraries/language.html +++ b/user_guide/libraries/language.html @@ -110,6 +110,16 @@ is the language set containing it (ie, english). If the second parameter is mis <p>Where <samp>language_key</samp> is the array key corresponding to the line you wish to show.</p>
<p>Note: This function simply returns the line. It does not echo it for you.</p>
+
+<h3>Using language lines as form labels</h3>
+
+<p>If your application requires it, a language line can automatically be output as a <label> by specifying a second parameter, which will become the "for" attribute of the label.</p>
+
+<code>
+$this->lang->line('<samp>language_key</samp>', '<samp>form_item_id</samp>'); <br />
+// becomes <label for="form_item_id">language_key</label>
+</code>
+
<h2>Auto-loading Languages</h2>
<p>If you find that you need a particular language globally throughout your application, you can tell CodeIgniter to <a href="../general/autoloader.html">auto-load</a> it during system initialization. This is done by opening the application/config/autoload.php file and adding the language(s) to the autoload array.</p>
<p> </p>
|