Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build
 |  Print Topic
Jump to first unread post. Pages: 1
NanookModerator
regular


Reg'd: Tue
Posts: 995
Loc: South East England
PHP Cookie Theme Help
      #150909 - Sun Jan 16 2005 06:46 PM

Hi
I have a system which is supposed to allow each user to choose a theme, and then it gives a different CSS Style Sheet depending on which selection is made, if no selection is made or a new user visits the default style sheet, in this case 'default' is used.
However all that shows is the default style sheet, how can I get it to use the correct style sheet?

Code to check if cookie present on index.php
---

<link rel="stylesheet" type="text/css"
media="screen" title="User
Defined Style" href="<?php
$sitestyle = (!isset($sitestyle)) ? "default" : $sitestyle;
echo $sitestyle;
?>.css" />

---
Code to choose style sheet
---

<form action="switcher.php" method="post">
<select name="set">
<option value="default" selected>Simple</option>
<option value="red">Red</option>
<option value="crazy">Crazy</option>
<option value="warm">Warm</option>
</select>
<input type="submit" value="Change Style"><a href="javascript:popup('help.php#style')">help</a> </form>

---
Code of switcher.php
---

<?php
setcookie ('sitestyle', $HTTP_GET_VARS['set'], time()+31536000, '/', 'swamp.hostcubed.com', '0'); header("Location: $HTTP_REFERER");
?>

--

As mentioned there is no error given, it only uses the default style sheet no matter what.

Any help would be appreciated.

*Nanook


Post Extras: Print Post   Remind Me!   Notify Moderator  
paul_lomax



Reg'd: Wed
Posts: 1661
Loc: London, England
Re: PHP Cookie Theme Help [Re: Nanook]
      #150910 - Sun Jan 16 2005 06:47 PM

Are you doing $sitestyle = $_COOKIES['sitestyle']; at any point to get the variable from the cookie?
www.webuser.co.uk/amazon/


Paul Lomax
Internet Technology Manager
IPC Country and Leisure Media
- www.ipcmedia.com


Post Extras: Print Post   Remind Me!   Notify Moderator  
NanookModerator
regular


Reg'd: Tue
Posts: 995
Loc: South East England
Re: PHP Cookie Theme Help [Re: paul_lomax]
      #150912 - Sun Jan 16 2005 06:49 PM

I have just added it so it now looks like
--

<?php
$sitestyle = $_COOKIES['sitestyle'];
?>
<link rel="stylesheet" type="text/css"
media="screen" title="User
Defined Style" href="<?php
$sitestyle = (!isset($sitestyle)) ? "default" : $sitestyle;
echo $sitestyle;
?>.css" />

---

But it still doesnt work



Edited by nanook on 16/01/2005 19:03 (server time).



Post Extras: Print Post   Remind Me!   Notify Moderator  
NanookModerator
regular


Reg'd: Tue
Posts: 995
Loc: South East England
Re: PHP Cookie Theme Help [Re: Nanook]
      #151387 - Mon Jan 17 2005 11:06 PM

If any body wants to help, I still need it


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1

Rate this topic

Jump to


Extra information
0 registered and 2 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Topic views: 352

Contact Us | Privacy statement Main website