CodeIgniter Forums
Global parameters - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Global parameters (/showthread.php?tid=12170)



Global parameters - El Forum - 10-08-2008

[eluser]GrootBaas[/eluser]
Hi there,

I am trying to create some kind of global parameters. The code flows between 3 controllers before it calls the model, where I want to use the parameters.

I tried using the config class, but when you set the config, it only seems to last while the class is active, it does not change the config value indefinitely.

Is there any other way?

Your help would be much appreciated.


Global parameters - El Forum - 10-09-2008

[eluser]Rick Jolly[/eluser]
I'm not sure that I understand your question.

By "global parameters", do you mean global variables? A parameter is a function argument.

By "the code flows between 3 controllers", do you mean there are 3 browser requests, or do you mean you're using an altered CI that is able to call a controller method from another controller.

If I had to guess, I'd say you are trying to store some user data between 3 page requests. In that case, use the session. You wouldn't want to use the config or any other global persistent storage for user data, since all users would use the same storage and overwrite each other's data.


Global parameters - El Forum - 10-09-2008

[eluser]gRoberts[/eluser]
What about using either flashdata or sessions?


Global parameters - El Forum - 10-09-2008

[eluser]jrlooney[/eluser]
did you try putting them in config/config.php ?


Global parameters - El Forum - 10-09-2008

[eluser]GrootBaas[/eluser]
[quote author="jrlooney" date="1223580674"]did you try putting them in config/config.php ?[/quote]

Yes, the config files does only last for the life of the class.

I will try sessions ...