Jump to content

Question no idea where to look for answers..


risingdragon

Recommended Posts

:) I was wondering if anyone can tell me how to make it where its possible to change the layout of my website on my website when a guest clicks on the design they want. if that makes since. the only way I can think of doing it is by having 3 or 4 different versions on it and by clicking on one you get the information out of a different directory I don't know how to explain it if you know what I mean and can help please let me know if not ill try to explain it better. but I do know of an example on www.inuyashajourney.com at the top of the right column. :)
Link to comment
Share on other sites

So you want a skin selector. You can do it with php kinda like going to www.yoururlhere.com/index.php?skin=skin color hereAnd depending on the skin color you chose it would put a different stylesheet on. I don't know php, unfortunatley, so I can't help.

Link to comment
Share on other sites

If you do not have access to or knowledge of a scripting language like asp, php, or cold fusion, then you could explore a technique I've seen before (sorry can't find URL at this time) where the entire site is changed just by selecting a particular stylesheet file. You could have the use select a CSS and use javascript to define which CSS reference gets pulled. This way you only code your pages once but you have as many CSS files as you want designs.

Link to comment
Share on other sites

That's very easy, all you have to do is this in javascript at the very top:

<script type="text/javascript">var x=document.getElementById("thing").selectedIndexswitch(x){case "1"document.write('<link rel="stylesheet" href="puturlhere" />')break...................}</script>

I'm not sure about the first part, where you're setting the variable, but that's the basic idea behind that way of doing it.

Link to comment
Share on other sites

javascripts the key:create a file (filename).js and place this in it

function setActiveStyleSheet(title) {  var i, a, main;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {  if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {  a.disabled = true;  if(a.getAttribute("title") == title) a.disabled = false;  }	}}function getActiveStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");  }  return null;}function getPreferredStyleSheet() {  var i, a;  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {    if(a.getAttribute("rel").indexOf("style") != -1       && a.getAttribute("rel").indexOf("alt") == -1       && a.getAttribute("title")       ) return a.getAttribute("title");  }  return null;}function createCookie(name,value,days) {  if (days) {    var date = new Date();    date.setTime(date.getTime()+(days*24*60*60*1000));    var expires = "; expires="+date.toGMTString();  }  else expires = "";  document.cookie = name+"="+value+expires+"; path=/";}function readCookie(name) {  var nameEQ = name + "=";  var ca = document.cookie.split(';');  for(var i=0;i < ca.length;i++) {    var c = ca[i];    while (c.charAt(0)==' ') c = c.substring(1,c.length);    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);  }  return null;}window.onload = function(e) {  var cookie = readCookie("style");  var title = cookie ? cookie : getPreferredStyleSheet();  setActiveStyleSheet(title);}window.onunload = function(e) {  var title = getActiveStyleSheet();  createCookie("style", title, 365);}var cookie = readCookie("style");var title = cookie ? cookie : getPreferredStyleSheet();setActiveStyleSheet(title);

make 3 or 4 different stylesheets and place this in the page

<html><head><script type="text/javascript" src="(filename).js"></script><link rel="stylesheet" type="text/css" href="../../other/default.css" title="default" /><link rel="alternate stylesheet" type="text/css" href="../../other/pink.css" title="test2" /></head><body><a href="java script://" onclick="setActiveStyleSheet('default'); return false;">Default  (test1)</a> <a href="java script://" class="theme" onclick="setActiveStyleSheet('test2'); return false;">test2</a></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...