RSS ? Recent Blog Posts

Blogs » Archive for April 22nd, 2004

What you should know about CSS 2.1

by Simon Willison

CSS 2 revision 1 has been out as a candidate recommendation for nearly two months now, but there’s been surprisingly little discussion of it around the web. It’s an interesting specification, and one that any standards conscious web developer should be aware of.

CSS 2.1 revises CSS 2 to better reflect the current state of the browser market, and to build upon lessons learnt in the four years since CSS 2 was released. It trims out a number of features that were never really adopted by the overall CSS community, such as aural stylesheets (now relegated to an Appendix) and adds a small number of widely requested or implemented features, such as the colour keyword ‘orange’.

The best guide to what’s new in CSS 2.1 can be found in the specification itself in the CSS 2.1 vs CSS 2 section. While most of the differences are subtle, the end result is a significant improvement over CSS 2 and forms a much better foundation for CSS going forward.

 

Is It Time to Take the Leap and Start Your Own Business?

by Andrew Neitlich

Based on comments received so far, many Sitepoint readers appear to want to start their own business, someday, and are not quite ready to take the leap. Please don’t live in “someday.” If you want to start a business — if you’d feel like you’d have wasted your life if you never got around to starting something up — then get a plan in place today.

Here are five elements that you need to succeed. Three are very practical, and two are more in the psychological realm. Please read them and take the challenge at the end of this blog:

1. A solution. You can be a freelance web designer if you want, but why not dream bigger? Why not create a solution that you can sell again and again, without having to trade your time for dollars? That way, you make more money for less of your time. A good solution solves a real problem that people in a focused target market have, in ways that make them more money and also make them feel better (e.g. less stress and frustration, the thrill of success and prosperity, security, etc.). Web design might be only one small part of that solution; you …

 

Serializing PHP data structures for Javascript

by Harry Fuecks

Currently messing with some code that serializes PHP data structures into Javascript and back, as a means for easy data exchange.

Going from Javascript to PHP is fairly easily done (see user comments at http://www.php.net/serialize) by generating strings PHP is capable of unserializing e.g;

String.prototype.toPHP=function() {
var s = this
s=s.replace(/\\/g, “\\\\”)
s=s.replace(/\”/g, “\\\”")
s=s.replace(/\n/g, “\\n”)
s=s.replace(/\r/g, “”)
return ’s:’+s.length+’:”‘+s+’”;’;
}

That modifies Javascript String class so you can call toPHP() on any string and get a PHP-serialized representation of it.

Going the other way, with what I’ve currently got, if I have a simple PHP array like;

$a = array(’x',’y');

a “serialized” string ready for “unpacking” by Javascript, would be;

‘new Function(\’var a = new Array();a[0]=”x”;a[1]=”y”;return a\’);’

If I’ve got that string in a Javascript variable called “serializedData” (perhaps fetched via XMLHttpRequest), I can use it like;

// Creates a function object
unserializedDataFunc = eval(serializedData);

// Get back the data from the function object
unserializedData = unserializedDataFunc();

The reason for using a Function object combined with eval() is so I can avoid all naming conflicts in Javascript. Not 100% sure this is the best mechanism to “serialize” a data structure for Javascript – escaping quotes is likely to be …

 

PGA 2003 Dynamic Cross Fading Image Loader Source

by sgrosvenor

Todd Dominey has released an open source version of the ever popular dynamic cross fading image loader that was used on the 2003 PGA Championship site.

Using external JPGs and an easily configurable XML file to handle the filenames and directory structure, not to mention control over delay and image order why not take a look and see how it works for you.

Click Here to visit the site and download the source.

 

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...