Advertisement:

Author Topic: Alternate stylesheets with 1 theme  (Read 17508 times)

Offline snork13

  • SMF Friend
  • Sophist Member
  • *
  • Posts: 1,305
  • Gender: Male
  • so little time
    • simplemachines.org
Alternate stylesheets with 1 theme
« 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:

Code: [Select]
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js"></script>
 after add:
   
Code: [Select]
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/styleswitcher.js"></script>
in index.template find:
Code: [Select]
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />';
replace with:
Code: [Select]
<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:
Code: [Select]
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
« Last Edit: August 02, 2005, 07:24:11 PM by snork13 »
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

Offline Red-Omni

  • Jr. Member
  • **
  • Posts: 129
  • Gender: Male
Re: Alternate stylesheets with 1 theme
« Reply #1 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 ?

Offline BryanD

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 22,021
  • Gender: Male
    • BryanRunicDeakin on Facebook
    • @bryandeakin on Twitter
    • Bryan Deakin dot Com
Re: Alternate stylesheets with 1 theme
« Reply #2 on: August 16, 2006, 02:12:46 AM »

Offline Red-Omni

  • Jr. Member
  • **
  • Posts: 129
  • Gender: Male
Re: Alternate stylesheets with 1 theme
« Reply #3 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 .  ;)