Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

Saving state(very limited)

Recommended Posts

I could pass this through get, but I need something more sub-stantial, I think get would cause me problems.  Ok I have a site I am building, I have a problem(I am still in planning phase), so I am working out all my programming plans, and design plans ahead of time, adn trying a totally different approach.  WHen I seem to go over all the programming logic ahead of time, I uncover problems I would have ran into during the process.  I figure out what's worth doing, and what needs to be scraped, and that is going to help me during the development process.  There is one issue I ran across, on the homepage(it's a classified ads site), I have a list of things on the homepage, but there is a case/switch statment, with includes, that decides what is included for the main area. See it's based on schools, so I need to be able to make it, based on which one was selected, that include is shown, but stays shown until they switch schools, and it has to be something that all user's can use.  Should I save it in with whatever sessions they are using, and let it carry around with there specific session, but on the homepage, I am starting the include out as a specific one, so when they change it, I am trying to figure out a good way to save the school, I need to start the school at a specific one of course, but I wanted to get an idea, of that.  I am thinking of carrying it around based on the user, within a session(using the same session they are logged in with, does this sound like a good idea.

Share this post


Link to post
Share on other sites
In this situation, it has to be final than that.  For instance, it starts off with one chosen by default, then select a different one from a drop down menu, which is going to change it, but it stay's changed at this point.  I may have them as links, but I want to keep the programming clean on this one, ahving a bunch of get's feeding back onto the same page, will get a little aggravating, I am in the planning phase, and have 2 weeks from monday, so I am coming up with ideas ahead of time, do you think using hte sessions will work as well, so it can register the session, and put the proper includes based on the session that is registered?

Share this post


Link to post
Share on other sites
Hi there business man, I have read your post several times, to try and figure out what it is that you want. What are you trying to save? What is selected? If you are trying to display items that a user has selected and display them across your site, then yes you could use a session, but remember a session will be lost when it expires. So when the user is logged out or the session expires the data will be lost.

Alternativly you could use cookies to track user selection or what ever, and have the cookie expire after a week or a month or when ever. This way as long as a cookie is available your users can come back and there previous selections would still be available. Disadvantage is that if a user has a high selected security on their browser, then cookies might not be saved depending on the security level. Also when the user clears out their cookies the the data will be lost.

If you just want to display selected items by the user for the duration of the time they are logged in then just use sessions. Unless some one has a better idea.

Share this post


Link to post
Share on other sites
i would go for session variables. and if you want the user's selection to be more permanent than for the duration of the session, store the value in your db for later retrieval.

Share this post


Link to post
Share on other sites
yes, I was thinking sessions, I just needed some help with the brainstorming, thanks for the input

Share this post


Link to post
Share on other sites
No probs business man, best of luck with your project.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.