Welcome Guest, Not a member yet? Register   Sign In
Global parameters
#1

[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.
#2

[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.
#3

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

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

[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 ...




Theme © iAndrew 2016 - Forum software by © MyBB