CodeIgniter Forums
How can they store and view labeles into array at language/label_lang.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: How can they store and view labeles into array at language/label_lang.php (/showthread.php?tid=34646)



How can they store and view labeles into array at language/label_lang.php - El Forum - 10-05-2010

[eluser]Julia Yan[/eluser]
---------- method 1
stor label one by one, that work

----------language/label_lang.php
$lang['title'] = 'Welcome to my blog';
$lang['heading'] = 'Julia Blog';
$lang['copyright'] = 'Copyright Reserved By XXX';

----------controllers/home.php
$data['title'] = $this->lang->line('title');

-----------views/home.php
<?php echo $title; ?>

---------- method 2
stor label by array, that does notwork
----------language/label_lang.php
$lang = array (
'title' => 'Welcome to my blog',
'heading' => 'Julia Blog',
'copyright' => 'Copyright Reserved By XXX',
);

----------controllers/home.php
$data['label'][] = $this->lang->line(); //???error

-----------views/home.php
<?php echo $label['title']; ?> //??? error