regoch Posted December 20, 2011 Share Posted December 20, 2011 I was wondering if there is any way to let visitor chose image background of div and store it in session so every page have same background? Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/ Share on other sites More sharing options...
dzelenika Posted December 20, 2011 Share Posted December 20, 2011 You shuld save only name of image in session Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299642 Share on other sites More sharing options...
regoch Posted December 20, 2011 Author Share Posted December 20, 2011 and how to put it in? by javascript? Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299647 Share on other sites More sharing options...
SergeiSS Posted December 20, 2011 Share Posted December 20, 2011 You'd better say the aim of this action. Maybe it's better to use CSS for it. Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299655 Share on other sites More sharing options...
Ivan Ivković Posted December 20, 2011 Share Posted December 20, 2011 Pass the image name with AJAX to a PHP file, then reload the background image with javascript. Just one method out of possible tons of them. Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299660 Share on other sites More sharing options...
dzelenika Posted December 20, 2011 Share Posted December 20, 2011 Rather create two diferent css files and store css fiolename in session variable Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299669 Share on other sites More sharing options...
regoch Posted December 20, 2011 Author Share Posted December 20, 2011 something like language changing script? have different file for different language and change it via session? Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299727 Share on other sites More sharing options...
SergeiSS Posted December 20, 2011 Share Posted December 20, 2011 something like language changing script? have different file for different language and change it via session? Yes, approximately the same. Logic is simple. When you are creating page, you tell the name of CSS file to use. If you keep in session a name of non-default file, just tell this name. Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299732 Share on other sites More sharing options...
regoch Posted December 20, 2011 Author Share Posted December 20, 2011 Gonna try! thanks to all! I try to find a tutorial online but, nothing! Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299848 Share on other sites More sharing options...
regoch Posted December 20, 2011 Author Share Posted December 20, 2011 Will this session have conflict with my language session? Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299887 Share on other sites More sharing options...
dzelenika Posted December 20, 2011 Share Posted December 20, 2011 there should exists two different session variables, one for language and other for selected css Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299911 Share on other sites More sharing options...
regoch Posted December 20, 2011 Author Share Posted December 20, 2011 You can write post about it on your blog, ! Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299924 Share on other sites More sharing options...
dzelenika Posted December 21, 2011 Share Posted December 21, 2011 I will, next week. thanks for the idea. Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1299962 Share on other sites More sharing options...
SergeiSS Posted December 21, 2011 Share Posted December 21, 2011 Will this session have conflict with my language session? This question show that you don't understand session. I'll explain in short. Session use the file for every user that have a session. These files are stored at the server. The storage duration could be changed. In such a file some variables are stored. When user is connected and he has a session (session ID is stored in the cookie at client side), then server look for his own file. If this file is found then server knows all session variables for this user. It means that you have one session only but a lot of session variables that could be used for different purposes. Quote Link to comment https://forums.phpfreaks.com/topic/253531-background-image-store-in-sesion/#findComment-1300001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.