Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 1 | ############### |
| 2 | Language Helper |
| 3 | ############### |
| 4 | |
| 5 | The Language Helper file contains functions that assist in working with |
| 6 | language files. |
| 7 | |
| 8 | .. contents:: Page Contents |
| 9 | |
| 10 | Loading this Helper |
| 11 | =================== |
| 12 | |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 13 | This helper is loaded using the following code:: |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 14 | |
| 15 | $this->load->helper('language'); |
| 16 | |
| 17 | The following functions are available: |
| 18 | |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 19 | lang() |
| 20 | ====== |
| 21 | |
Andrey Andreev | 3b40706 | 2012-11-26 23:55:37 +0200 | [diff] [blame] | 22 | .. php:function:: lang($line, $for = '', $attributes = array()) |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 23 | |
| 24 | :param string $line: Language line key |
Andrey Andreev | 3b40706 | 2012-11-26 23:55:37 +0200 | [diff] [blame] | 25 | :param string $for: HTML "for" attribute (ID of the element we're creating a label for) |
| 26 | :param array $attributes: Any additional HTML attributes |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 27 | :returns: string |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 28 | |
| 29 | This function returns a line of text from a loaded language file with |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 30 | simplified syntax that may be more desirable for view files than |
| 31 | ``CI_Lang::line()``. |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 32 | |
Andrey Andreev | 53b8ef5 | 2012-11-08 21:38:53 +0200 | [diff] [blame] | 33 | Example:: |
Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 34 | |
Andrey Andreev | 3b40706 | 2012-11-26 23:55:37 +0200 | [diff] [blame] | 35 | echo lang('language_key', 'form_item_id', array('class' => 'myClass'); |
| 36 | // Outputs: <label for="form_item_id" class="myClass">Language line</label> |