1
studioC
help please within php ???
  • 2004/2/27 13:06

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hello all ! I have a big problem, i don't know much about php, but i want to implement a styleswitcher ala ...http://www.alistapart.com/articles/phpswitch ... but it gets me crazy last 2 days...

what i've done sofar is:

in theme.html:


and this is the switcher.php which i put in the root of that domain...

$set = $_GET['set'];
$set = preg_replace('#[^a-zA-Z0-9_-]#', '', $set);
setcookie ('sitestyle', $set, time()+31536000, '/', '.yellowbyte.com', '0');
header('Location: '.$_SERVER['HTTP_REFERER']);
?>

it works so far that i dont get a blank page , but it don't changes path to stylesheet... he renders that php into link rel stylesheet ...but seems to forget that echo... all i get back is "domain/userstyles/style.css" but no changes when click on e.g. red ....??

someone out there with a solution ?
michael


2
studioC
Re: help please within php ???
  • 2004/2/27 19:18

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


ok... i've just managed to install a styleswitcher which uses session id instead of cookies, i hope there are no problems using mozilla ? .. Please have a look ...
at... http://yellowbyte.com

thanks for comments ... Please! if there will be someone with more knowledge in php, please! help ... within that solution i still had to use the links changing styles within the theme.html (within block the link within
michael

3
Dave_L
Re: help please within php ???
  • 2004/2/27 19:46

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Instead of

<{php}>echo(!isset($sitestyle))?'style':$sitestyle<{/php}>


I would use

<{if isset($smarty.cookies.sitestyle)}><{$smarty.cookies.sitestyle}><{else}>   style<{/if}>


However, it's insecure to blindly use a cookie value to construct a path. The value should be checked first, to make sure it's reasonable.

4
studioC
Re: help please within php ???
  • 2004/2/27 21:06

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks dave, i will try it, if actual solutions does not work. Shouldn't it possible to use XOOPS cookie? hm.. thanks again..

michael

Login

Who's Online

268 user(s) are online (170 user(s) are browsing Support Forums)


Members: 0


Guests: 268


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