How can i make my own config file? |
[eluser]developer10[/eluser]
i want to have a file to store my config items. what is the best way of doing this and how am i supposed to retrieve config items from it? i tried something like this, but it didn't work (NOTE: i looked into some app and tried to replicate this): i created a file named "app_config" and saved it in the config folder of my application. Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); then in my file "Functions" which is located in library folder, put this: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); in my controller, i load this library Code: $this->load->library('functions'); Now, i try to retrieve "some_item" value from config (with or without "echo"): Code: $this->app_config->some_item; Code: $this->functions->some_item; EDIT: neither of those ways works. is this the correct way or i'm doing something wrong? do i really need to import config file into library file before i'm able to use it, or there's a better solution? Thanks!
[eluser]flaky[/eluser]
this is how you retrieve config values Code: $var = $this->config->item('some_item');
[eluser]Phil Sturgeon[/eluser]
http://ellislab.com/codeigniter/user-gui...onfig.html
[eluser]developer10[/eluser]
[quote author="Phil Sturgeon" date="1262188546"]http://ellislab.com/codeigniter/user-gui...onfig.html[/quote] thanks, i didnt know this existed in user guide |
Welcome Guest, Not a member yet? Register Sign In |