Jump to content


session variables/cookies


5 replies to this topic

#1 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 02 February 2007 - 12:52 AM

I have created a custom template for my website, allowing each user to have their own template.
There are a couple of problems with this:
When the user updates their template they cannot view it right away because the old template is loaded before....and it is reading the database each time.
It was suggested that I use session variables or cookies for this, does anyone have a tutorial/can write one to help me with this specifically?
Also, which would you recommend me doing?
Thanks.

Edited by tgs, 02 February 2007 - 12:52 AM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 02 February 2007 - 12:55 AM

So, you're saying you have template 1. User selects template 2, hits submit, template 1 loads and then they go to the next page and template 2 loads, correct?

Personally, i don't see whats wrong with this, phpBB acts the same way, but why not just update the database before you select the template value? Heck, you could update then redirect to a new page before the first template even gets a chance to be selected.

Edited by rc69, 02 February 2007 - 12:57 AM.


#3 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 02 February 2007 - 01:08 AM

That is what's happening but not in that way. They don't choose between templates (although I intend to make that an option in the near future) but they select their own sizes/colors/images in text boxes.

But you're saying I should have it update whenever they click out of the box or whatever?

#4 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 02 February 2007 - 02:20 PM

So what you're saying is that the template loads, and in the style chooser, they input text-size, color, etc... values, and you want it to update the template with the inputed values as soon as it happens without having to refresh the page, right?

If so, then you could just use an onBlur event and have JS update the style right then (keep in mind, JS styles and CSS styles have different names. i.e. In JS font-size is fontSize i believe). After that, you can have them hit a save button to accept the changes, or something else to ignore the changes.

Edited by rc69, 02 February 2007 - 02:21 PM.


#5 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 03 February 2007 - 02:35 AM

No, that's not what I meant. I meant when the hit submit and the page refreshes have it update & show it on that page load.

#6 blacky

    Young Padawan

  • Members
  • Pip
  • 34 posts
  • Gender:Male

Posted 03 February 2007 - 02:47 AM

have a page that just says "wait while other page loads... redirecting... blah blah.." and on taht page, have the info. update, just like uhh.... rc said :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users