summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/language_helper.rst
blob: 9e5d9bdc9650adeabc21644a7eca3510e4c71dbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
###############
Language Helper
###############

The Language Helper file contains functions that assist in working with
language files.

.. contents::
  :local:

.. raw:: html

  <div class="custom-index container"></div>

Loading this Helper
===================

This helper is loaded using the following code::

	$this->load->helper('language');

Available Functions
===================

The following functions are available:


.. function:: lang($line[, $for = ''[, $attributes = array()]])

  :param	string	$line: Language line key
  :param	string	$for: HTML "for" attribute (ID of the element we're creating a label for)
  :param	array	$attributes: Any additional HTML attributes
  :returns:	string

  This function returns a line of text from a loaded language file with
  simplified syntax that may be more desirable for view files than
  ``CI_Lang::line()``.

  Example::

  	echo lang('language_key', 'form_item_id', array('class' => 'myClass');
  	// Outputs: <label for="form_item_id" class="myClass">Language line</label>