Welcome Guest, Not a member yet? Register   Sign In
Global Objects and HMVC
#1

[eluser]Unknown[/eluser]
Hi all,
this is Fabrizio and I’m quite new of CI so please don’t blame at me!

I’m developing with HMVC MX extension and I like it very much for its ease of use and scalability.

For my new web app I’d like to load certain “objects” (let me be generic for the moment) to use from different modules.

For example I would like the user authentication to be verified before any controller is loaded (without having to perform this check INSIDE the controller); at the same time I would like to store user information in a globally accessible object.

For example, imagine I’ve already logged in into my web app and all my user info has been placed into session. Then a controller is called: I’d like all the user data from the session to be stored in something called $User.
Then, from any point of my web app, I’d like to call $User->doSomething() or get some $User->property.

Do you think that could be a valid approach? In this case, how would you implement that?
There is a better way to do what I’d like to?

Thank you all in advance for your help.

Ciao,
Fabrizio
#2

[eluser]InsiteFX[/eluser]
1) Use a MY_Controller
2) Create a Registry library
#3

[eluser]ivantcholakov[/eluser]
Yes, registry library for HMVC.

http://ellislab.com/forums/viewthread/241311/




Theme © iAndrew 2016 - Forum software by © MyBB