Archive for the ‘Web development’ Category

Why Use a PHP Framework?

June 25, 2008

At last night’s NY-PHP gathering, a fellow PHP’er and I discussed PHP frameworks. I told her I was developing an e-commerce site using Zend Framework. She replied that she’d been considering frameworks, especially Cake and Symfony, “but I’m not sure I need a framework at all. I write my own SQL; my apps work fine. What would a framework do for me?”

Setting aside the differences between PHP frameworks, I’m aware of at least 4 reasons to use them:

  1. Modular design : A home-grown application, with its ad hoc growth, can become a tangled mess that’s hard to change or enhance. Most mainstream frameworks provide a modular design that makes it easier to modify or add components.
  2. Flexible components : Sure, you can write your own authorization class in PHP, but why reinvent the wheel? The framework will provide an integrated component that handles not only your current needs, but requirements that you haven’t yet encountered (but that the framework’s community has). With a framework, chances are that you won’t have to re-architect your authorization system when the users ask for something new.
  3. Best practices: As you use the framework, you’ll begin to absorb the practices and (we hope) good habits of the framework’s creators.
  4. New capabilities: Frameworks regularly add functionality to help developers implement new technology. These days, common enhancements involve AJAX and connections to the APIs of popular web service providers.

Developers may understandably wonder if mastering a framework is worth the learning curve. In my opinion, the effort to learn a framework will be repaid with applications that are well-architected, flexible, and maintainable.

Brand your site with a favicon

May 25, 2007

Favicons are those eye-catching little pictures that appear in your web browser’s address bar, favorites list (hence the name favicon, short for “favorites icon”), and, with modern tabbed browsers, on tabs.

Instantly recognizable when designed well, favicons represent the brand identity of sites that use them.


Examples

Wikipedia uses the “W” from its logo:
Wikipedia’s favicon

Digg’s favicon represents a person holding a shovel, an image that seems to have been created especially for the favicon:
Digg’s favicon


Usability in a tabbed, multitasking world

Tabbed browsers, such as Firefox and Internet Explorer 7, can show many page-tabs at once, squishing a site’s descriptive text.
Below are examples of tabs without favicons. What sites are they? I don’t know.
FireFox tabs without favicons

These have favicons. At a glance I see a seated robed figure (meditation site), a stylized “Ti” that I recognize as my private TikiWiki site, and a picture of me, which (if I can stop admiring its beauty for a moment), I know represents my blog.
FireFox tabs with favicons


Create your own mini work of art

Favicons are ordinary graphics, generally 16×16 pixels in size, named favicon.ico. How to make them? I found an easy method that even non-artists can use.

The free site FavIcon from Pics allows anyone to convert a normal-sized graphic into a favicon. Instructions:

  1. Go to FavIcon from Pics.
  2. Click the “Browse…” button to select an image from your computer’s hard drive.
  3. Click “Generate FavIcon.ico.”
  4. After a few seconds, the site will show a preview image and a download link.
  5. If you are pleased with your creation, download favicon.ico to your computer. Then transfer that file, via FTP or your preferred method, to your website’s root folder (often /public_html or /www).
  6. View your website with its new addition! (You might have to press the refresh button to make the favicon appear.)


Show your art

If this article inspired you to create a favicon, please add a comment here with the link to your newly enhanced site.

PHP mail() on IBM System i

October 7, 2006

My new article about mail() is available at MC Press Online. The article covers:

  • Zend Core’s implementation of mail() for IBM System i
  • How mail() compares to packages such as PHPMailer
  • Function definition and example
  • How to configure SMTP in Zend Core
  • Overriding defaults with ini_set
  • Troubleshooting

Read it here.

Javascript Debugger for FireFox: FireBug

September 29, 2006

Powerful yet unobtrusive, FireBug, a FireFox Extension by Joe Hewitt, runs in a frame that pops up only when requested or when an error occurs. It helped me solve two javascript problems today.

Thanks to Dell Sala, who told me about FireBug at Tuesday’s New York PHP meeting.