Welcome Guest, Not a member yet? Register   Sign In
load->model call constructor. I don't need it
#1

[eluser]MDomansky[/eluser]
Hi,

$this->load->model('user');

CI call constructor of user class and it will be available by $this->user. I don't need it.

How can I determine when I want to run constructor?

Thanks in advice
#2

[eluser]TheFuzzy0ne[/eluser]
I don't understand... The constructor is called automatically by PHP when an object is instantiated. If you have things that need doing "after" instantiation, you'd probably be better of putting the code in a method called "init", or "initialize" and calling that when you want to.
#3

[eluser]MDomansky[/eluser]
I have meant about parameters for constructor.

I want to run constructor with parameters I give.
$u = new user(1, TRUE);

How can I do it through CI?

PS: sorry for my english
#4

[eluser]Dreammaker[/eluser]
I think if you need load configs it make sense to use a library instead model.

Or you can use some method for loading parameters after initialization.

<offtop>
Я так подозреваю тут для большей половины английский не родной и все боятся чтобы не попалили Big Grin
</offtop>




Theme © iAndrew 2016 - Forum software by © MyBB