Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: snork13 on August 02, 2005, 07:21:50 PM

Title: Alternate stylesheets with 1 theme
Post by: snork13 on August 02, 2005, 07:21:50 PM
file edited:

index.template

file added:

style2.css  (themes/your_theme_name/
styleswitcher.js  (themes/default/



in index.template find:

<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>

after add:
   <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/styleswitcher.js"></script>

in index.template find:
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />';

replace with:
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" title="default"/>
<link rel="alternate stylesheet" type="text/css" href="', $settings['theme_url'], '/style2.css" title="style2"/>';


and then somewhere, I have mine in the user info box! and only in my case group4 gets to change the style. you can change the group within the array!

in index.template insert:
if (in_array(4, $GLOBALS['user_info']['groups']))     
echo 'Style: <a href="#" onclick="setActiveStyleSheet(\'default\'); return false;" title="Change to the default stylesheet">default</a> |
<a href="#" onclick="setActiveStyleSheet(\'style2\'); return false;" title="Change to style2">style2</a>';


copy your themes stylesheet (style.css) and rename style2.css and upload to your the same theme folder.

last you will need to upload styleswitcher.js to your default theme directory

I used in in my coppemine gallery and thought it would be cool in smf, didn't find anything like it in with a search of the board, thought other might like the change!

-snork
Title: Re: Alternate stylesheets with 1 theme
Post by: Red-Omni on August 15, 2006, 11:39:57 PM
hello , i have tried your mod with RC2 and i seemed to get a error . well , i was able to repair that error but now when i click style2.css it switches but doesnt show the back ground or the images .
( such as catbg , titlebg , etc..etc.. )

can you help me ?
Title: Re: Alternate stylesheets with 1 theme
Post by: Deaks on August 16, 2006, 02:12:46 AM
you could also try Different Stylesheets in the one Theme (http://www.simplemachines.org/community/index.php?topic=102787.0)
Title: Re: Alternate stylesheets with 1 theme
Post by: Red-Omni on August 16, 2006, 03:50:45 AM
i did that one , but it wasnt exactly what i was looking for .
this one seems to suit me better .

thanks for the link though .  ;)