Where can I place my “global” function, which will check, if user is logged in?
Because I want to do something like: user is able to browse some pages only when the function isLogged() returns TRUE, and I’d have to use it in some views, that’s why it should be a “global” function, which I can access from anywhere.
Is that possible? Or there is any better solution for this?
You should probably put it into a Library, and autoload the library. When you need to use the “logged_in” flag in a view, pass it in from the controller. Example:
application/libraries/Auth.phpapplication/config/autoload.php`application/controllers/welcome.php
application/views/my_view.php