Welcome Guest, Not a member yet? Register   Sign In
What is the best way to store a variable(state)?

Hi to all!

I'm new in CodeIgniter and I have a pretty basic question.

Say that I have a multilanguage site (english + greek).

The site starts with 2 language buttons.

What is the best way to store the language state (according to which button the user pressed)?

Should I use sessions or something else?

An the same goes for my menu.

What is the best way to find out whenever use a controller to which part of the site you are (for example I have clicked the 2nd menu btn and after that the 3rd submenu btn).

Should I use sessions again to store the current menu states?

Thanx a lot for any answers.


Hi and welcome to the forums!

To solve your language issue have a look at this page:

For your second question: via your url segments you allways
know which controller and method is "active". Reading an processing
that information you don't need to store that somehow.

More about URIs in Codeigniter:

Hope that helps - cheers

Wow! That was fast! Thanx a lot.

Regarding the language question, I'll dig in the link you gave me. It seems great!

Regarding the menu question, from what I get is when I click a menu button, it should redirect me to a url like this


and pass the menubtn2, submenubtn3 and submenubtn4 uri segments to the menu_generate function right?

Thanx again.


Theme © iAndrew 2016 - Forum software by © MyBB