Here is a thread that I found in a Google search:
http://www.daniweb.com/forums/thread62265.html It gives code that will generate a style sheet link on the home page. Can anyone add additional code that could be added to internal pages to pick up on the homepage selection and use it on the rest of the internal pages. I would be great if cookies could be avoided as some users don't like them and a site then would not look great. Here is a link to a simple two page site that uses cookies, but it has issues if cookies are disallowed: http://www.rspsitedesign.com/Random/
Many Thanks.
printman55
0
Light Poster
Recommended Answers
Jump to PostJS can write cookies - but you don't want this.
php/other server side languages can use querystrings (url parameters) to propagate the chosen css sheet.However, the best way - if you don't want to use cookies would be to use session variables.
php example:
Link list
…
Jump to PostOK - php or js can select a random stylesheet. Using sessions - you can propagate the css along the pages.
At the very top of every page:
<?php session_start(); if(!isset($_SESSION['css'])){ $css_list = array("colourful.css","darkness.css","bright.css"); $int = mt_rand(0, count($css_list)-1); $_SESSION['css'] = $css_list[$int]; } ?>
Then in your …
Jump to PostYes it does, so you've probably got different code to me:
Try this - I've sectioned the include file and javascript -
http://www.cemeg.wetwork.org.uk/cookiecss/untitled.php
Will upload the zip file for the example...//EDIT - here we go
//Just be aware that even when you …
Jump to PostIn the css_checker.php/css_checker2.php files, do this:
$css_list = array("bright.css","dark.css","color.css");
default.css will not be chosen if cookies available.
No need to change the js. Just keep the default.css in there. It doesn't do anything with the php array. JS is run after the server sends the info …
Jump to Postreboot will probably clear session data. IE is a pig. We can probably use a line to prevent default.css from being called by php. Like this:
session_start(); if(!isset($_SESSION['css']) || $_SESSION['css'] == 'default.css'){ $css_list = array("bright.css","dark.css","color.css"); $int = mt_rand(0, count($css_list)-1); $_SESSION['css'] = $css_list[$int]; } $css_file = $_SESSION['css'];
If …
All 28 Replies

diafol
printman55
0
Light Poster

diafol
printman55
0
Light Poster

diafol
printman55
0
Light Poster

diafol

diafol
printman55
0
Light Poster

diafol

diafol
printman55
0
Light Poster

diafol
printman55
0
Light Poster
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster

diafol
printman55
0
Light Poster
printman55
0
Light Poster

diafol

diafol
printman55
0
Light Poster

diafol
printman55
0
Light Poster

diafol
printman55
0
Light Poster

diafol
printman55
commented:
He was very helpful in helping to develop the code I needed. Ardav is a real asset to the community.
+1
printman55
0
Light Poster

diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.