Welcome Guest, Not a member yet? Register   Sign In
country list
#1

[eluser]greenba[/eluser]
Hello,

I would like to add country list in array in one place so I can use it over and over again in different controllers.

Where should I store the country array?

Regards,
Green
#2

[eluser]richthegeek[/eluser]
language, probably
#3

[eluser]Colin Williams[/eluser]
config/config.php
#4

[eluser]greenba[/eluser]
Ok,

How to declare it in the config file, like this?

$config['country_list'] = array(
"AF" => "Afghanistan (افغانستان)",
"AX" => "Aland Islands",
"AL" => "Albania (Shqipëria)",
"DZ" => "Algeria (الجزائر)",
"AS" => "American Samoa"
}

How should I call it in the controller?

Thanx
#5

[eluser]Colin Williams[/eluser]
Code:
$countries = config_item('country_list');

Don't be afraid to look at the User Guide. This is all covered in depth.
#6

[eluser]greenba[/eluser]
Thanx Colin.




Theme © iAndrew 2016 - Forum software by © MyBB