session colours
session colours
basically i want to put a list of colours and when the user click the colour the stylesheet for that colour stays loaded.. i think its sessions?
would i do it in a form and form php to set the session, maybe a bit of a start would be helpful.. thanks
would i do it in a form and form php to set the session, maybe a bit of a start would be helpful.. thanks
I would put a signature.. BUT, i don't have the time.
Re: session colours
You can store the name of the css file in the session or database, then output it in the link tag
<link rel="stylesheet" type="text/css" href="ext/css/<?php echo $_SESSION['css']; ?>" />Something along those lines may work.
Re: session colours
how do i set the session say i hadjacek wrote:You can store the name of the css file in the session or database, then output it in the link tag
<link rel="stylesheet" type="text/css" href="ext/css/<?php echo $_SESSION['css']; ?>" />Something along those lines may work.
orange
yellow
red
blue
and they clicked red how would i set the session?
$_SESSION['css']==$red_css?
I would put a signature.. BUT, i don't have the time.
Re: session colours
ive workedi out.. it is what i just put, but im going to do a drop down box butwhen they set the session how would i refresh the page automatically for them?
I would put a signature.. BUT, i don't have the time.
Re: session colours
Clicking the submit button for the form with the drop down menu in should refresh the page ?ashwood wrote:but im going to do a drop down box butwhen they set the session how would i refresh the page automatically for them?
Re: session colours
jacek wrote:Clicking the submit button for the form with the drop down menu in should refresh the page ?ashwood wrote:but im going to do a drop down box butwhen they set the session how would i refresh the page automatically for them?
yeah but i don't want a submit button i just want it to drop down and they click and it refreshes not drop down choose then click go..
I would put a signature.. BUT, i don't have the time.
Re: session colours
oh right, you would have to use javascript for that then. you could have the form submitted with the onchange event for the drop down.
dropdown.onchange = function() { document.getElementById('form').submit(); }
Re: session colours
You can set a session variable like this.ashwood wrote:Orite mate,
About this session thing at the moment im not bothered about drop downs etc the main thing is setting the session because ive thought somewhere the default skin has to be set.. how do we change that session without destroying the first one because destroying the first logs the user out + no skin so site looks a mess..
Thanks
Ash
$_SESION['css'] = 'red.css';which will work as long as you have
session_start();at the top of the page.
Re: session colours
yes so that sets the default now how do we change the session when a user clicks a colour which is a link for the css which matches that colour?
I would put a signature.. BUT, i don't have the time.
Re: session colours
i still dont get it though because rite say i had
<a href='red'>red</a>
and so on..
when they click that i want the session to change to red.. im really lost with all this :\
<a href='red'>red</a>
and so on..
when they click that i want the session to change to red.. im really lost with all this :\
I would put a signature.. BUT, i don't have the time.
Re: session colours
You would link to
<a href="?css=red">Red</a>And then set the session to the value.
if (isset($_GET['css'])){ $_SESSION['css'] = $_POST['css']; }It would also be worth making sure the css file exists before allowing it to be changed.
Re: session colours
this:jacek wrote:You would link to
<a href="?css=red">Red</a>And then set the session to the value.
if (isset($_GET['css'])){ $_SESSION['css'] = $_POST['css']; }It would also be worth making sure the css file exists before allowing it to be changed.
if (isset($_GET['css'])){ $_SESSION['css'] = $_POST['css']; }if i change to
if (isset($_GET['css'])){ $_SESSION['css'] = "style_red/stylesheet.css"; }that would set the session correct? and change the session['css']; to the red.. which will automatically stop the $_SESSION referring to the default one i am going to have to put at the top of my index page.. which then confuses me more because.. everytime the user clicks home the stylesheet is going to set back to default as it will go
$_SESSION['css'] = "default/stylesheet.css";
<link href='<?php echo $_SESSION['css']'; ?> rel='stylesheet' type='text/css' />
if you get that..
I would put a signature.. BUT, i don't have the time.
Re: session colours
Looks like it, you could just try it thoughashwood wrote:that would set the session correct?
indeed, you need to only set the default if there is not one set and they have not clicked on a link.ashwood wrote:everytime the user clicks home the stylesheet is going to set back to default as it will go
Re: session colours
how do i do this because if the user is first visiting the site the default skin needs to be there if you get me..jacek wrote: indeed, you need to only set the default if there is not one set and they have not clicked on a link.
I would put a signature.. BUT, i don't have the time.
Re: session colours
You could check if the session is empty and if it is, set the default sessionashwood wrote: how do i do this because if the user is first visiting the site the default skin needs to be there if you get me..
Re: session colours
so whatEcazS wrote:You could check if the session is empty and if it is, set the default sessionashwood wrote: how do i do this because if the user is first visiting the site the default skin needs to be there if you get me..
if($_SESSION['css']="") { $_SESSION['css']="default/stylesheet.css" }that?
I would put a signature.. BUT, i don't have the time.
Re: session colours
Something along those lines, yes.
You could also use the empty function to see if it's empty
You could also use the empty function to see if it's empty
if(empty($_SESSION['css']))
Re: session colours
http://www.aatm-online.co.uk at the top you can see that it says empty thats because i have this:
NOTE: sorry for linking my website but examples may help deal with the issue easier
if(empty($_SESSION['stylesheet'])) { echo "Empty"; } else echo "Not Empty";i go http://www.aatm-online.co.uk/style.php which contains..
$_SESSION['stylesheet']="ashwood"; echo "Changing stylesheet";i go on the style page.. then i go back home.. but the session is still empty?
NOTE: sorry for linking my website but examples may help deal with the issue easier
I would put a signature.. BUT, i don't have the time.
Re: session colours
ive sorted it.. i forgot session_start() on the style.php page..
I would put a signature.. BUT, i don't have the time.
Re: session colours
i was thinking when the user is logged in thats when they will be able to change the style.. when they log out it session_destroy() doesnt only log out but it now kills that style session should i leave it like that you think as the user can only change the style when they are logged in?
I would put a signature.. BUT, i don't have the time.