1) You need to, without using cookies, be able to store your screen
layout information in a single string. I suggest name/value pairs
using a simple separator that you and then Split() to get back your
data.

2) Re-build your screen layout using that same string.

3) Once you've mastered that then move onto storing the same data in a
cookie, since cookies can only store strings.

Here's a few simple functions for reading/writing cookies.

function getCookie(c_name) {
        if (document.cookie.length>0)
          {
          c_start=document.cookie.indexOf(c_name + "=")
          if (c_start!=-1)
                {
                c_start=c_start + c_name.length+1
                c_end=document.cookie.indexOf(";",c_start)
                if (c_end==-1) c_end=document.cookie.length
                return unescape(document.cookie.substring(c_start,c_end))
                }
          }
        return ""
}

function setCookie(c_name,value,expiredays) {
        var exdate=new Date()
        exdate.setDate(exdate.getDate()+expiredays)
        document.cookie=c_name+ "=" +escape(value)+
        ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}



On Jul 2, 5:10 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> problem: i have a page full of divs (a la iGoogle) that are movable. i
> need to be able to save the page layout pref. in cookies when the user
> leaves the page, so the divs will appear in the same configuration
> when they user comes back. so far my searches have been fruitless.
>
> i'm using sortables in script.aculo.us, and i think what i need might
> already be in the code someplace. but i'm a total n00b, so if anyone
> can point me in the right direction, i'd be much abliged.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to