Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Monday, April 23, 2007

PHPTriad Successor

In my early days with PHP, I used to love PHPTriad which installed and configured PHP, Apache and MySQL on my Windows machine instantly. The process of downloading each separately, installing each then configuring them to work together on your Windows machine was really a pain. So PHPTriad was a killer package back then.

As PHPTriad was ditched and not maintined, it was no longer an option, since it did not keep up with new versions of PHP, MySQL and Apache. Despite a recent renewed interest in the resurrection of PHPTriad under the new name of Sokkit, which is a commercial alternative, yet another free open source alternative seems to be on the rise.

XAMPP is the strong PHPTriad alternative, adequately replacing it and filling the gap. It is available for a number of different platforms.

Creating Site Search with PHP

If your web site has a large number of pages, it might be a good idea to augment the navigation structure with a handy search facility. This can be done using PHP as this ONLamp article shows.

Sunday, April 22, 2007

BambooINVOICE Built with CodeIgniter

BambooINVOICE is a simple open source invoicing web application built using CodeIgniter. The interesting thing is that you can download the code and see how a complete real-life web application is built with CodeIgniter as its framework.

Wednesday, April 18, 2007

Video Tutorial - AJAX in PHP

Derek Allard made an interesting video tutorial on how to use AJAX within the CodeIgniter PHP framework to create a cool web application with AJAX flavored search capabilities. Derek makes use of Scriptaculous to incorporate AJAX capabilities into this tiny web application.

Tuesday, April 17, 2007

Colorize Code

CodeIgniter offers a really cool and handy helper function called highlight_code(). It is a handy little function that allows you to pass it a string of text including HTML tags, PHP code ... etc and it returns a colorized version of that string highlighting the code and tags in distinct colors.

I wish I'd known abou this nifty function before when I was struggling with creating tutorial web pages that included HTML code and I longed find a way to highlight such code easily.

Word Inflection in CodeIgniter

I love the cool idea of providing inflection helper functions in CodeIgniter. They allow you to get the plural, singular, camel case ... etc of a word.

Monday, April 16, 2007

endforeach

I never knew before this day that PHP offered an alternate syntax for closing blocks of code. The standard syntax which we are used to and comes from the C programming language is opening and closing braces: { and }. For instance:

foreach($list as $item)
{
    echo $item;
}

The alternative syntax I just knew about today is like this:
foreach($list as $item):
    echo $item;
endforeach
Quite cool. Other control statements as well can be closed in a similar manner. Check out the alternative syntax for control structures from the PHP manual.

Thursday, April 12, 2007

Two-Level Menu with PHP

Here is how to make a dynamic database-driven two-level menu with PHP.

Wednesday, April 11, 2007

PHP and Python Creators Working for Yahoo and Google

It's interesting that Rasmus Lerdorf, creator of PHP, has been employed by Yahoo! as an Infrastructure Architecture Engineer since September 2002.

It's more interesting that as of October 2005, Guido van Rossum, creator of Python, has been hired by Google and became a Google software engineer.

Tuesday, April 10, 2007

MySQLi

For those still using the old MySQL functions of PHP, perhaps it is time to take a fresh look at an improved version of this old extension. MySQLi (MySQL improved) is the newer PHP extension that allows you to do prepared statements among many other cool things that the old MySQL extent ion does not offer.

Saturday, April 07, 2007

PHP Creator is Against Frameworks

Rasmus Lerdorf, the creator of PHP, strikes a high note against PHP frameworks. I live this article written by him because it takes a lot of the hype away from the insane number of PHP frameworks that are sprouting by and creating a lot of confusion for newbies to PHP.

His article shows how to build a web application designed on the MVC pattern without having to use one of the popular PHP frameworks. His message is essentially that you better evolve your own framework that is best suited to your own needs than spend your time trying to learn a ready-made framework that might turn out to be tough to tame for your needs as your web application grows.

At the end of his article The no-framework PHP MVC framework, Lerdorf concludes that:
Many frameworks may look very appealing at first glance because they seem to reduce web application development to a couple of trivial steps ..., but these same shortcuts are likely to be your bottlenecks as well since they achieve this simplicity by sacrificing flexibility and performance. ... Instead of starting by fixing the mistakes in some foreign framework and refactoring all the things that don't apply to your environment spend your time building a lean and reusable pattern that fits your requirements directly. In the end I think you will find that your homegrown small framework has saved you time and aggravation and you end up with a better product.
Instead of relying on a canned framework, Lerdrof applies "an MVC approach with clean and simple views and still have all the goodness of fancy Web 2.0 features" using the following technologies:

Coding Standards

It's often of great benefit to stick to some coding standards when a system is being built by a team of developers. Even in case of a single developer following some form of code standards would be of great benefit. Sticking to coding standards makes it easier to understand the code written, easier to find bugs and makes the code less prone to having bugs in the first place.

Here are some coding standards for PHP that have been set forth by the PEAR group. Even if you are not writing code for PEAR, it might be a good idea to incorporate some or all of their coding standards while writing your own code.

CodeIgniter

CodeIgniter is a simple yet powerful PHP framework. What I like about it is its simplicity. There are other more sophisticated PHP frameworks that might be more powerful and offer a more rich set of features, yet CodeIgniter wins when it comes to simplifying things in a pretty way. Its learning curve is also not as steep as other frameworks.

Friday, March 30, 2007

Use SQLite not MySQL

When thinking of developing a new web site using PHP, it is a no brainer which database management system you will be using. MySQL has become the standard in developing web applications based on open source technologies even in the case of many enterprise Java projects. Some would prefer to use PostgreSQL due to its more complex features, yet MySQL still remains the king and a common denominator in most PHP web applications.

Although I have looked at SQLite with some interest in the past, yet I had never took it seriously as an option when creating a web application. Under "Situations Where SQLite Works Well" at the official SQLite web site, they mention the following:
SQLite usually will work great as the database engine for low to medium traffic websites ... . The amount of web traffic that SQLite can handle depends, of course, on how heavily the website uses its database. Generally speaking, any site that gets fewer than a 100000 hits/day should work fine with SQLite.
Not bad. Not bad at all.

Although such claims should still be verified, yet I just tend to believe them. Now if you are thinking BIG of your next killer web application which will attract millions of users, perhaps even in this case it would not hurt if you start out small at first with SQLite then switch later on to MySQL when you need to scale. As Getting Real suggest, it is better to start with a simple solution and then scale later.

Monday, March 19, 2007

Sending HTML Email with PHP

Here is an example showing how to send HTML email using the PHP mail function.

Monday, March 12, 2007

Creating a PHP Login System

PHP Login System with Admin Features shows you how to create a complete login system for your web site using PHP. Any web site that allows users to sign up would need some sort of login system. Not only does the above example give complete code to accomplish this, but it also goes ahead to explain the code so you can modify it to your liking later on according to your need.

Saturday, March 10, 2007

Borland and PHP

CodeGear, a Borland spinoff, has released Delphy for PHP. That's an interesting concept. Delphy has been known as a visual RAD tool for developing applications based on the Pascal programming language. As PHP's popularity is souring, CodeGear decided to catch part of the action by introducing PHP support in Delphy.

Thursday, March 08, 2007

Show Files in Directory using PHP

This example shows how to use PHP to get a list of all files in the current directory. It proved to be handy when I wanted to create a list of links to all files in the directory. I wanted the list of inks to be updated automatically as I ad new files. The readdir PHP commands has the solution.

Thursday, March 01, 2007

"What's my Name?" Asks PHP

$_SERVER['PHP_SELF'] returns the PHP filename in which the script is running. It turns out to be handy at many occasions when you need to use the name of the PHP file in which the script is running.

Sunday, February 25, 2007

PHP Flavored Eclipse

The PDT Project is promising to offer a distinctive PHP flavor to the Eclipse IDE. the PDT is still in its infancy, yet as it matures, it might be a strong contender to other PHP development tools out there.