What is the best way to store a variable(state)? |
[eluser]Unknown[/eluser]
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. Cheers!
[eluser]LuckyFella73[/eluser]
Hi and welcome to the forums! To solve your language issue have a look at this page: http://maestric.com/doc/php/codeigniter_i18n 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: http://ellislab.com/codeigniter/user-gui...s/uri.html http://ellislab.com/codeigniter/user-gui...elper.html Hope that helps - cheers
[eluser]Unknown[/eluser]
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 home/menu_generate/menubtn2/submenubtn3/submenubtn4 and pass the menubtn2, submenubtn3 and submenubtn4 uri segments to the menu_generate function right? Thanx again. Cheers |
Welcome Guest, Not a member yet? Register Sign In |