mikachu Posted August 9, 2007 Share Posted August 9, 2007 Hi, I'm working on a multilingual site where i use a lexicon for words that are used repeatedly throughout it. Now I load it every time a page loads from the backend, but i would like it if i can store it on the clients computer, so it's save bandwidth and the site gets a bit faster. Here is what i had in mind: if (isset($_COOKIE['lexicon_' . $language_obj['id']])) { $lexicon_obj = $_COOKIE['lexicon_' . $language_obj['id']]; } else { $lexicon_con = $st->connectObject('site/lexicon/' . $language_obj['id']); $lexicon_obj = $lexicon_con->getData(); /* $lexicon_obj looks now like this and i use it throughout the site: $lexicon_obj['name'] $lexicon_obj['about'] .... */ setcookie('lexicon_' . $language_obj['id'], $lexicon_obj); } When i do this i get an error that it's not permitted to put an array into a cookie. Does someone know a solution for this problem? Or maybe another idea that i haven't thought about? Thanks in advance, Mika Link to comment https://forums.phpfreaks.com/topic/64112-object-in-cookie/ Share on other sites More sharing options...
trq Posted August 9, 2007 Share Posted August 9, 2007 serialize(). Link to comment https://forums.phpfreaks.com/topic/64112-object-in-cookie/#findComment-319508 Share on other sites More sharing options...
mikachu Posted August 9, 2007 Author Share Posted August 9, 2007 Mmmh that simple... i feel ashamed Thanks!!! Link to comment https://forums.phpfreaks.com/topic/64112-object-in-cookie/#findComment-319511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.