[eluser]OKIEWARDOYO[/eluser]
Hem, thanks for reply, what about if i have another example like below,
this is my project structure for example,
root/
__application/
____models/
______mymodellang.php
__system/
__lang/
____en.php
__index.php
__.htaccess
look, i have an en.php there,
this en.php contain the code like below, it's an array
Code:
<?
//root/lang/en.php
//language file
$langs = array(
'_Home'=> 'Home',
'_People'=> 'People',
'_News'=> 'News',
'_Blogs'=> 'Blogs',
'_Register'=> 'Register',
'_Login'=> 'Login',
'_Email'=> 'Email',
);
?>
and, i have a mymodellang.php as the model of project,
Code:
<?php
//root/application/models/mymodellang.php
class Mymodellang extends CI_Model {
function __construct()
{
parent::__construct();
}
function translate($lang_key){
@include(LANGPATH.'en.php');
//global $langs; //i want this global varialbes
if(in_array($lang_key, array_keys($langs)))
return $langs[$lang_key];
else
return $lang_key;
}
}
?>
My problem is on my model, my translate function above contain @include(LANGPATH.'en.php');
I want to delete this line of code from the translate function, place it somewhere that can be access by global $langs.
but i don't know where to placed.
i have tried putting like below but no luck,
Code:
<?php
//root/application/models/mymodellang.php
@include(LANGPATH.'en.php');
class Mymodellang extends CI_Model {
function __construct()
{
parent::__construct();
}
function translate($lang_key){
global $langs; //i want this global varialbes
if(in_array($lang_key, array_keys($langs)))
return $langs[$lang_key];
else
return $lang_key;
}
i want this en.php stay on folder lang/
i don't want to create my_controller or another extra config,
can somebody help me??
thanks