Welcome Guest, Not a member yet? Register   Sign In
How to echo a value from an array using the Language class

The question might sound silly but if I have a multidimensional array in a language file, how can I load the content in my view? Say in my controller I have

class Statics extends CI_Controller {

public function index($page = 'home')
  // load language file

And then in my language file

$lang = array(
'description'   => array(    
    'main'  => 'Convallis habitant ultrices torquent consectetur sagittis eget metus magna elit fermentum diam tortor ad viverra nec consectetur id ac aliquam hac lobortis malesuada elit, elementum mollis tempor aliquam per nulla ipsum. Molestie non elit nec ante leo nam hendrerit aenean mauris aenean iaculis fringilla.')

How can I echo 'main'? I've tried the following to no avail. Thanks for your help.

<p>&lt;?php echo lang('description.main')?&gt;</p>

&lt;!-- I know it's wrong but tried it anyway --&gt;
<p>&lt;?php echo lang('home.description.main')?&gt;</p>

Please note that my program was tested successfully if I have something like $lang['description.main'] = 'text here...'. For me it would be better to have all my data in an mutlidimensional array.

Messages In This Thread
How to echo a value from an array using the Language class - by El Forum - 06-11-2013, 01:51 PM

Theme © iAndrew 2016 - Forum software by © MyBB