Welcome Guest, Not a member yet? Register   Sign In
My own classes and the code used everytime
#1

[eluser]Rvnikita[/eluser]
Hi!
First off all thanks you very much because ofCodeigniter.
I use it and i like it, but I have 2 questions:

1) I have some code, that I used everytime on site, for example some initial code, that i must call in every controller in every function (before the execution)
Now I made a init model and in every controller first off all i call it
Code:
$this->load->model('init_m');
$this->init_m->make_init();

How can I wrote init code, that will be automaticly call before any controller?

2) I need some class, for example user class with different params and functions.
Code:
$user->name, $user->surname, $user->is_18_year_old()
How can i do it right?

Thank's you very much and sorry for my english .(
#2

[eluser]Colin Williams[/eluser]
Create a pre_controller hook: http://ellislab.com/codeigniter/user-gui...hooks.html
#3

[eluser]Rvnikita[/eluser]
[quote author="Colin Williams" date="1225604759"]Create a pre_controller hook: http://ellislab.com/codeigniter/user-gui...hooks.html[/quote]

OOh! Thanks you very very much!




Theme © iAndrew 2016 - Forum software by © MyBB