Archive for August 24th, 2006

Prism-Perfect.net: PHP Tag Cloud Tutorial

As pointed out in this post on the Zend Developer Zone, the tag cloud can be a valuable tool to any site using tags for its articles/posts. They also mention a tutorial to help you build one.

Well, it’s actually so simple it’s not really a tutorial at all so much as a snippet with a bit of explanation. But I’ve had some people ask how it’s done, so here’s how I do it. I tried to go through and add some comments about what’s happening.

The code pulls the information from a backend database and calculates out what size each of the items needs to be based on the max and min values set in the script.

Continue Reading · Add comment

PHP.net: Mastering Regular Expressions - now with PHP coverage

On PHP.net today, there’s a note about an addition to the O’Reilly classic book (an asset to any developer’s library) “Mastering Regular Expressions” - a full 48-page chapter on PHP.

The book is described as:

Mastering Regular Expressions quickly covers the basics of regular-expression syntax, then delves into the mechanics of expression-processing, common pitfalls, performance issues, and implementation-specific differences. Written in an engaging style and sprinkled with solutions to complex real-world problems, Mastering Regular Expressions offers a wealth information that you can put to immediate use.

This new edition is the third release for the book.

Continue Reading · Add comment

Felix Geisendorfer’s Blog: Controller Testing in CakePHP

In this new post on ThinkingPHP.org, Felix Geisendorfer talks about some of the development work that he’s been doing regarding CakePHP:

My first idea was to do unit testing on Controllers. I made a little comment about it here and uploaded some of my experimental code for that. In the beginning it looked very promising. I was able to mock Models & Components and add them to the Controller. But the deeper I got into it, the more I realized: Unit Testing with Controllers is insane

To back it up he points out some of the hurdles he had to work with and includes some of the code he used to test the Controllers he had made inside of CakePHP.

Continue Reading · Add comment

Ryan Malesevich’s Blog: WP Plugins: WP-Wap, Make a WAP Version of Your Blog

Ryan Malesevich has posted another brief look at a WordPress plugin on his blog today - this time, it’s WP-Wap, an additon to WordPress to help make a WAP version of the site.

I saw this on TechBuzz and thought it was really cool. WP-Wap is not a plugin per se, more like an addition to Wordpress, but it creates a completely WAP compatible version of your blog. Now I know not many people are going to be using a phone to read your blog, but what if there’s that one person who’s a little weird in the head that wants to do that. You can’t exclude that person.

Thankfully, this plugin is just as easy to install as some of its siblings (slightly different, but still easy). Then, it does the rest of the work for you - making the WAP pages automatically.

Continue Reading · Add comment

456Bereastreet.com: Build your own PHP style sheet switcher

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.

Continue Reading · Add comment