Transliteration in PHP 5.4

February 1, 2012

In the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book, titled “[intlink id=”1582″ type=”page”]PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide[/intlink]”, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn’t want to complete the book, only to have it be outdated immediately thereafter (using PHP 6 wasn’t, by the way, an attempt to trick the reader into buying the book, as some cynical people have suggested). Well…[intlink id=”1067″ type=”post”]PHP 6 ended up dying due to many complications[/intlink] and I had the proverbial egg on my face (what one reader rightfully called my “Dewey Defeats Truman” moment). In truth, only about 5% of the book or so required PHP 6, so it wasn’t a devastating mistake, but I certainly felt foolish.

I had specifically wanted to discuss PHP 6 because of its intended support for Unicode, which is what the code in the book requires for a couple of examples. Even though PHP 6 was shelved, the key components have since been integrated into PHP 5.2, 5.3, and the forthcoming 5.4. Transliteration, the ability to convert text from one alphabet to another, was demonstrated in the book using the PHP 6 str_transliterate() function. That function went belly-up, and PHP 5.4 now has the Transliterator class instead. The documentation for the class in non-existent, but here’s what I figured out… Continue Reading…

In this edition…

Continue Reading…

LongTailVideo, makers of the popular JW Player (a video player for Web pages), just posted a long article titled “The State Of HTML5 Video.” I used JW Player on a couple of projects and was quite pleased with its usability and reliability. My experience was with using JW Player to present Flash video, but the player has since been modified to serve either Flash content or HTML5 video, which is great. Towards that end, the article presents the current state of HTML5-related features and functionality, with lots of stats about browser compatibility, what attributes and video formats can be used, and so forth.

If you present video on Web sites, whether you use the JW Player or not, it’s worth checking out to know where things stand. LongTailVideo intends to maintain and update that article as changes in the industry (such as statistical changes and the like) evolve.

I recently stumbled upon impress.js, a truly amazing Web-based presentation tool. You have got to check out the demo page (in a modern browser), you will be blown away. After running through the presentation (which will only take a minute), check out the HTML source code to be further amazed. I’m normally not this hyperbolic, but I was quite stunned by what was possible with impress.js. Besides being a useful tool for HTML-based presentations, this library is capable of changing how one thinks of presentations as a concept. Instead of presenting information in a linear, traditional format, with impress.js, you can do things like go from a bigger picture to a smaller picture, to be able to zoom in on content, as it were. If you pay attention to the URLs, you’ll note that impress.js also creates bookmark-able pages, which is an added bonus.

If you check out the corresponding README file on GitHub, you’ll find links to other presentations created with impress.js. A couple of presentations are quite useful in that they demonstrate, in my opinion, an overuse of impress.js. Those particular presentations use the rotation feature to such as extent that it makes one dizzy, which is normally not a good quality in a presentation (although one presentation is talking about 3D transformations, so there’s some justification there). One does worry that if impress.js catches on too much, we’ll all be sick of rotating transitions in no time.

For an example of another interesting use of impress.js, check out lioshi toiles, where impress.js creates a site that displays artwork in a truly interesting way. Taken a step further, Al Ingham’s site, uses impress.js for custom navigation and presentation, while still providing direct links to specific pages across the top of the page (because walking through all the “slides” to get where you needed to be is unreasonable).

If only I had any design skills whatsoever…

UPDATE: Amazon currently has the book for sale at $30.47, as I write this.

I am very happy to say that my latest book, Modern JavaScript: Develop and Design, is official done. Well, not done, but close enough to blog about it. I just submitted the last chapter to be written, Chapter 13, Frameworks. In it, I quickly discuss how to choose a framework, when you should use a framework, and some common libraries (as a framework alternative). The bulk of the chapter introduces and uses jQuery and the Yahoo! User Interface (YUI) Library. For both I explain how to perform common tasks—selecting DOM elements, DOM manipulation, event handling, and Ajax, and then walk through more advanced examples. For both, the chapter explains an autocomplete example, using a PHP script as the data source. For jQuery, I also discuss the DataTables plug-in. For YUI, I also discuss and demonstrate the Yahoo! Query Language (YQL). For it, I go through a couple of examples, including fetching a weather report and a stock quote. (For the record, I specifically target YUI3, which is an improvement over YUI1 and 2, even if some of the framework is currently in beta.)

Chapter 13 is the first chapter in Part 3 of the book, Next Steps. I already wrote Chapter 14, Advanced JavaScript, which has a heavy focus on closures. Chapter 15, A PHP and JavaScript Example, creates a pseudo-complete auction system. Auctions are set to expire on a certain date and time. Logged-in users can bid on items. All dates and times are shown using Coordinated Universal Time (UTC) or the user’s timezone, if the user is logged-in. Then, JavaScript used to enhance the experience. This includes using Ajax for the login and bid forms, retrieving the latest bids via Ajax (and updating the table of bids with them), and creating countdown timers that show them amount of time left in an auction, when that’s less than an hour. I think the chapter turned out well, and it emphasizes the various ways to pass data back and forth between PHP and JavaScript, a common point of confusion.

All of the initial writing is now complete. I’ve also done the rewrites on the first nine chapters. I still have to do the rewrites on the last six chapters, but that won’t take long. I will also be doing supporting videos and articles related to the book.

I believe the book will still ship, as originally planned, at the end of February. I am now going to go celebrate!