저는 간단하게 스타일쉬트로 해결했습니다. 미리 stylesheet 를 이용해 다양한 테마를 만들어 놓습니다. 그러니까, rainy_day.css, spring.css, summer.css, blue_lake.css, 등 같은 페이지 이지만 다른 분위기를 연출할 수 있는 스타일들을 미리 정의해 놓는 겁니다.
그런 다음, 유저가 맘에 드는 테마(스타일쉬트)를 고르게 해줍니다.
<a href="./switcher.php?set=red">
RED 테마를 선택하려면 여기를 클릭하세요</a>
RED 테마를 선택하려면 여기를 클릭하세요</a>
이제 switcher.php 를 만듭니다.
<?php
setcookie ('sitestyle', $set, time()+31536000, '/', 'yourdomain.com', '0');
header("Location: $HTTP_REFERER");
?>
setcookie ('sitestyle', $set, time()+31536000, '/', 'yourdomain.com', '0');
header("Location: $HTTP_REFERER");
?>
이렇게 해서 넘겨받은 테마 값을 쿠키에 저장해서 유저 컴퓨터에 1년간 보관합니다. 테마 보존 기간은 각자의 상황에 맞게 바꿔주면 되겠지요.
마지막으로 브라우저에서 유저가 쿠키에 보관중인 테마를 알려주면 됩니다.
<head>
<link rel="stylesheet" type="text/css" media="screen" title="User Defined Style" href="<?php echo
(!$sitestyle)?'defaultstyle':$sitestyle ?>.css" />
<link rel="stylesheet" type="text/css" media="screen" title="User Defined Style" href="<?php echo
(!$sitestyle)?'defaultstyle':$sitestyle ?>.css" />
참고로 현재 익스플로러에서는 지원되지 않지만, IE를 제외한 넷스케이프 6 이상이나 모질라 1 이상 버전에서는 지원해 오고있는 대체 스타일쉬트 기능을 이용하는 것도 유저에게 다양한 사이트 테마를 제공하는 방법이 될것 같군요.
<link rel="alternate stylesheet" type="text/css" media="screen" title="Fire Engine Red" href="./redstyle.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="Grape" href="./purple.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="Scary" href="./blackout.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="Grape" href="./purple.css" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="Scary" href="./blackout.css" />
위와 같이 하면 사용자 브라우저(Netscape, Mozilla, FireFox) 메뉴에서 View --> Page Style 을 통해 미리 정해놓은 테마(스타일)를 선택할 수 있지요.




