1
simeon
Style switcher wont work
  • 2005/2/15 7:10

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


hi there

i wrote a css switcher for my new themes but it wont work.maybe i missed something?
here it is

in the head of my theme i got
<link rel="stylesheet" type="text/css" media="screen" href="<{php}> echo (!$sitestyle)?'http://mysite.com/themes/mytheme/style':$sitestyle <{/php}>.css" />


in the body
<a href="http://mysite.com/themes/mytheme/switcher.php?set=style2">Style2a>


switcher.php contains
('sitestyle'$settime()+31536000'/''mysite.com''0');
  
header("Location: $HTTP_REFERER");
  
?>


the both css style.css and style2.css are located in my theme folder.

when i click the link the site is refreshing but the style isnt changing.
i hope you can help me.ive tried to replace "set=style2" with "set=http://mysite.com/themes/mytheme/style2" but no changes.

thanks in advance

2
studioC
Re: Style switcher wont work
  • 2005/2/15 9:06

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


Hallo Simeon

yes there was a long discussion about such a switcher on ALA some years ago ..., but most of them were not really happy using the beginning code.

perhaps have a look at page 3 of that diskussion, i now use this:

session_start();
?>
if(isset($_GET['css'])){
switch (
$_GET['css']) {
case 
'css1':
$stylesheet '';
$_SESSION['csschanger']=$stylesheet;
break;
case 
'css2':
$stylesheet '';
$_SESSION['csschanger']=$stylesheet;
break;
case 
'css3':
$stylesheet '';
$_SESSION['csschanger']=$stylesheet;
break;
case 
'css4':
$stylesheet '';
$_SESSION['csschanger']=$stylesheet;
break;
default:
$stylesheet '';
$_SESSION['csschanger']=$stylesheet;
}
}
?>



CSS Changer

echo ($_SESSION['csschanger'])? $_SESSION['csschanger']: ';?>



echo $_SERVER['PHP_SELF']; ?>?css=css1">Stylesheet 1
echo $_SERVER['PHP_SELF']; ?>?css=css2">Stylesheet 2
echo $_SERVER['PHP_SELF']; ?>?css=css3">Stylesheet 3
echo $_SERVER['PHP_SELF']; ?>?css=css4">Stylesheet 4



to switch my styles and it works perfect, though i can't say if there are any security things ...

perhaps have a look at it ...


http://www.alistapart.com/discuss/phpswitch/3/


Viel Spass damit ...
michael

3
studioC
Re: Style switcher wont work
  • 2005/2/15 9:11

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


uuuh.. did i forget to mention that you sure have to replace
...
with smarty
<{php> and<{/php}>


and of course change the path to your css ....
sorry..

michael

4
simeon
Re: Style switcher wont work
  • 2005/2/15 9:15

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


hi michael

thanks first
i saw that session thing too.maybe i shouldnt use the shortest way everytime ;)
[ger]wär halt schon schick gewesen das mit fünf zeilen code gebacken zu bekommen *g*
danke nochmal[/ger]

sime

5
studioC
Re: Style switcher wont work
  • 2005/2/15 9:18

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


ja ... das ist wahr ... wenn du etwas in der kurzen art findest, bitte sag bescheid ...

thanks
michael

6
JasonMR
Re: Style switcher wont work
  • 2005/2/15 10:23

  • JasonMR

  • Just can't stay away

  • Posts: 655

  • Since: 2004/6/21


Hey Simeon!

We are just working on a project named "XOOPS Theme Forge" (which amongst hosting design specific projects, will host a vast collection of articles regarding theme, and web design), and it would be great if you could prepare an article, so that others may gain from your experience....

Would you feel up to it? Then please contact me or StudioC via PM

Regards

JasonMR


[outline of article]
articleTitle: How to implement a Style Sheet Switcher
covering:
- what it does
- how it does it
- what to watch out for/problem sources
- implementation recommendation w/ code
[/outline of article]

[ger]Du kannst den Artikel auch in Deutsch verfassen, ich wuerde das Uebersetzen uebernehmen... [/ger]

7
simeon
Re: Style switcher wont work
  • 2005/2/15 10:37

  • simeon

  • Not too shy to talk

  • Posts: 104

  • Since: 2003/12/18


wenns in deutsch auch passt mach ich das sehr gern ;)
Ich schreibs zusammen und schicks dir wenn mir deine mail addy gibs.
freu mich wenn ich helfen kann
sime

Login

Who's Online

386 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 386


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits