Object in PHP5 |
[eluser]Ajaxian64[/eluser]
Hello, I would like to save in Session some informations. I decided to store object, instead of array. Then, I have one class, I will create some object from its. Nevertheless my different controlers have to know the declaration of this class. --- My question is : what is the best place in the CI framework to define the class in order some of my controlers know it. (sorry for my english...I do my best) Thank you
[eluser]Jelmer[/eluser]
If I understand you correctly you need a class declared everywhere because you need to be able to load it from the session. (probably through serialize()/unserialize()?) The best way to do that is probably to create a library/model and put it in the autoload.php config file. Another way would be to implement a PHP5 autoloader, you can find an example I posted here. (I haven't tried if a PHP5 autoloader works when using unserialize, I would expect it to work though)
[eluser]Ajaxian64[/eluser]
Thank you jelmer, You have perfectly understood and your answer helps me a lot ! It is really great to have help in this forum. |
Welcome Guest, Not a member yet? Register Sign In |