Welcome Guest, Not a member yet? Register   Sign In
"$this->config->item" or just "config_item"
#1

[eluser]digfish[/eluser]
Hi people

I'm new to CodeIgniter and I just started learning it 1 month from now. Until now, I liked very much in experimenting it and I'm satisfied with its ease of use and low sloppy learning.

I've come across some stuff that if someone of you, the experienced guys, could help me.

In the user guide, to load a config value in the code, it's said that we should use:

Code:
$this->config->item('some_key')

but since I'm using eclipse as the IDE, its auto-completion feature suggested me someday to use

Code:
config_item('some_key')

instead of the above code which uses the "$this..." clause, and amazingly, I tried it, and it works !

This is just a function that will be deprecated or there is another examples that I could like 'load_library..." or 'load_helper...".

Which one of the two is the correct to use !?

Thanks in advance.
#2

[eluser]danmontgomery[/eluser]
Nothing wrong with using config_item(). It's included in the documentation.
#3

[eluser]@li[/eluser]
The help file does say that the 'config library is the prefered' way of dealing with config, indicating that in future this function might be deprecated.
#4

[eluser]InsiteFX[/eluser]
Gee! In the future CodeIgniter may not even exist.

@li, If you do not like the way CodeIgniter is doing things, go find a framework that suits your needs
and quit complaining about everything on these forums!

InsiteFX
#5

[eluser]digfish[/eluser]
Thanks for all your quick replies. So it doesn't matter using one or another.
I'll use config_item(), because it is shorter. I'm a lazy guy Smile
#6

[eluser]@li[/eluser]
[quote author="InsiteFX" date="1301446060"]Gee! In the future CodeIgniter may not even exist.

@li, If you do not like the way CodeIgniter is doing things, go find a framework that suits your needs
and quit complaining about everything on these forums!

InsiteFX[/quote]
you mad bro?
#7

[eluser]InsiteFX[/eluser]
Do I look mad?

InsiteFX
#8

[eluser]Eric Barnes[/eluser]
My personal opinion for what it is worth is I use $this->config->item inside controllers, models, etc. Then in view files I use config_item() to keep them cleaner.

Of course they both work so it is just a matter of preference.




Theme © iAndrew 2016 - Forum software by © MyBB