CSS Rotate v2

May 8th, 2008 | by | coding

May
08

Background: This projects began as a request from a friend.  His site, acting as a working demo, is at Fried Pope.  He wanted the ability to have different stylesheets govern the look of his site, and be chosen randomly for each visitor.  In short, he wanted to rotate his style sheets.

Project: The result from that request, plus a major recode, is linked below.  The system is designed to pick a stylesheet from the directory you specify, and redirect the user to it.  It will remember the stylesheet selected for the user for their entire visit, so your site doesn’t keep changing its look.  That would be confusing.

Compatibility: This project works in all known browsers.

Use: Using this tool is extremely simple.  You must have a web host that supports PHP.

  1. Uncompress the source code, and put ‘cssrotate2.php’ in your website’s directory
  2. Open ‘cssrotate2.php’ with an HTML editor
  3. If you need to, change the the line under the comments to specify where your styles are ($stylesdir = “./styles”;)
  4. Save and close it
  5. Open any pages in your site that you want to have use CSS Rotate
  6. Add a link to it like you would any other stylesheet (<link href=”./styles/cssrotate2.php” rel=”stylesheet” type=”text/css” />)
  7. Save and close those pages

download css rotate 2

Share

No Comments »

PHP, MySQL, and mysql_fetch_array()

April 3rd, 2008 | by | coding

Apr
03

Today, I spent a couple hours working on a customer management system for APS Web Design.  Over the course of that work, I discovered a very interesting behavior in a particular function, specifically mysql_fetch_array().

For those not familiar with it, but familiar with PHP, this function takes the results returned by mysql_query(), and turns it into an array of values.  There are two other functions that do similar things: mysql_fetch_row() and mysql_fetch_assoc().

mysql_fetch_row() ”fetches one row of data from the result associated with the specified result identifier.  The row is returned as an array.  Each result column is stored in an array offset, starting at offset 0″. source
Read full story

Share

No Comments »