Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

456Bereastreet.com:
Build your own PHP style sheet switcher
Aug 24, 2006 @ 20:19:11

At the 456 Berea St blog today, there's a popular new post that demonstrates a simple (yet effective) method for switching out the style sheets on your site at the whim of the user.

Want to have a style switcher that lets your site’s visitors choose a different style sheet? Want it to work even if there is no JavaScript support? The trick is to use a server-side language like PHP, which is what I use for my style switcher.

Using PHP to let the user switch to a different CSS file is nothing new. But it is one of the things that I am often asked about, so I thought it would be good to have a write-up to refer people to in the future.

The code for the switcher is only about five lines long, implementation and all, but it's a nice, clean way to do it. It would break if the viewer didn't have cookies allowed on their system, though.

tagged: style sheet switcher simple cookie import redirect style sheet switcher simple cookie import redirect

Link:

456Bereastreet.com:
Build your own PHP style sheet switcher
Aug 24, 2006 @ 20:19:11

At the 456 Berea St blog today, there's a popular new post that demonstrates a simple (yet effective) method for switching out the style sheets on your site at the whim of the user.

Want to have a style switcher that lets your site’s visitors choose a different style sheet? Want it to work even if there is no JavaScript support? The trick is to use a server-side language like PHP, which is what I use for my style switcher.

Using PHP to let the user switch to a different CSS file is nothing new. But it is one of the things that I am often asked about, so I thought it would be good to have a write-up to refer people to in the future.

The code for the switcher is only about five lines long, implementation and all, but it's a nice, clean way to do it. It would break if the viewer didn't have cookies allowed on their system, though.

tagged: style sheet switcher simple cookie import redirect style sheet switcher simple cookie import redirect

Link:

Builder.com.au:
Text-size switching with PHP and CSS
Dec 21, 2005 @ 13:12:17

From Builder.com.au today, there's this new tutorial with a helpful guide on how to create a text-switching script with CSS and a little help from PHP.

This tutorial will show you how to add such a text size switcher to your Web pages using PHP and CSS, thereby immediately making your Web site more accessible and scoring you useful brownie points from everyone over the age of 50. Keep reading, and find out how!

tagged: css text-size switcher tutorial css text-size switcher tutorial

Link:


Builder.com.au:
Text-size switching with PHP and CSS
Dec 21, 2005 @ 13:12:17

From Builder.com.au today, there's this new tutorial with a helpful guide on how to create a text-switching script with CSS and a little help from PHP.

This tutorial will show you how to add such a text size switcher to your Web pages using PHP and CSS, thereby immediately making your Web site more accessible and scoring you useful brownie points from everyone over the age of 50. Keep reading, and find out how!

tagged: css text-size switcher tutorial css text-size switcher tutorial

Link:


24ways.org:
Introducing UDASSS!
Dec 19, 2005 @ 13:27:01

On our sister site, AjaxDeveloper.org today, there's a new post that references an "Unobtrusive Degradable Ajax Style Sheet Switcher" powered on the backend by PHP - UDASSS.

First of all, the idea is very simple. I wanted something just like what Paul Sowden put together in Alternative Style: Working With Alternate Style Sheets from Alistapart Magazine EXCEPT a few minor (not-so-minor actually) differences which I've listed briefly below:

  • Allow users to switch styles without JavaScript enabled (degradable)
  • Preventing the F.O.U.C. before the window 'load' when getting preferred styles
  • Keep the JavaScript entirely off our markup (no onclick’s or onload’s)
  • Make it very very easy to implement (ok, Paul did that too)
What I did to achieve this was used server-side cookies instead of JavaScript cookies. Hence, PHP. However this isn't a "PHP style switcher" – which is where Ajax comes in. For the extreme technical folks, no, there is no xml involved here, or even a callback response. I only say Ajax because everyone knows what 'it' means. With that said, it’s the Ajax that sets the cookies 'on the fly'. Got it? Awesome!

The rest of the post is a tutorial on how to use it (simply), and a direct link to download it.

tagged: ajax usasss Unobtrusive Degradable Ajax Style Sheet Switcher ajax usasss Unobtrusive Degradable Ajax Style Sheet Switcher

Link:

24ways.org:
Introducing UDASSS!
Dec 19, 2005 @ 13:27:01

On our sister site, AjaxDeveloper.org today, there's a new post that references an "Unobtrusive Degradable Ajax Style Sheet Switcher" powered on the backend by PHP - UDASSS.

First of all, the idea is very simple. I wanted something just like what Paul Sowden put together in Alternative Style: Working With Alternate Style Sheets from Alistapart Magazine EXCEPT a few minor (not-so-minor actually) differences which I've listed briefly below:

  • Allow users to switch styles without JavaScript enabled (degradable)
  • Preventing the F.O.U.C. before the window 'load' when getting preferred styles
  • Keep the JavaScript entirely off our markup (no onclick’s or onload’s)
  • Make it very very easy to implement (ok, Paul did that too)
What I did to achieve this was used server-side cookies instead of JavaScript cookies. Hence, PHP. However this isn't a "PHP style switcher" – which is where Ajax comes in. For the extreme technical folks, no, there is no xml involved here, or even a callback response. I only say Ajax because everyone knows what 'it' means. With that said, it’s the Ajax that sets the cookies 'on the fly'. Got it? Awesome!

The rest of the post is a tutorial on how to use it (simply), and a direct link to download it.

tagged: ajax usasss Unobtrusive Degradable Ajax Style Sheet Switcher ajax usasss Unobtrusive Degradable Ajax Style Sheet Switcher

Link:


Trending Topics: