News:

Wondering if this will always be free?  See why free is better.

Main Menu

Alternate stylesheets with 1 theme

Started by snork13, August 02, 2005, 07:21:50 PM

Previous topic - Next topic

snork13

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
Mods
Please DO NOT PM me with requests for individual support, but post your questions and concerns in the appropriate section of the forum where other users can benefit from them as well. Thank you.
I have been super busy as of late. Working on updates to all my modifications for 2.0.1

Red-Omni

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 ?

Deaks

~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

Red-Omni

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 .  ;)

Advertisement: