The Apple Macintosh has long been the computing platform of choice for creative professionals – musicians, graphic artists and designers and increasingly film and video editors as well. With the advancements made by Apple’s latest operating system, OS X, the Mac is also quickly becoming the platform of choice for professional and hobbyist Internet developers as well.
One area where MacOS X has opened doors for Internet development is dynamic web site creation. With its UNIX-based underpinnings, MacOS X has opened the door for open-source developers to adapt the software used to construct these web sites to the Macintosh platform for the first time. Using these tools, anyone can use a Mac to build dynamic web sites.
The advantages of dynamic sites over traditional, static HTML sites are many. They add the ability to create one template for a site which can be reused numerous times, rather than forcing the creation of a new HTML document every time additions are needed for a site. This feature allows for rapid redesigns of a site, requiring changes to just one template rather than hundreds or thousands of static pages. Also, it can speed and simplify the process of adding new information to a site. Instead of building a new HTML page, putting in your content, then opening indices from all over the site to build links to the new page, on a dynamic site a person would simply log into the site with any web browser, input information into a form, submit it to the site - and the computer takes care of the rest.
What do I need to get started?
First, you’ll need a server capable of distributing dynamic content. This element will be the easiest piece of the puzzle. MacOS X includes a fully functional Apache web server, the most popular server environment on the Internet. According to the December, 2002 Netcraft Web Server Survey1, Apache currently powers 62 percent of the more than 35 million servers on the Internet. Apache replaces the Internet file sharing functionality from previous versions of MacOS and is activated by a single button in your System Preferences. Turn it on, and your humble Mac is instantly transformed into a speedy, stable and robust web server.
But in order to generate dynamic web sites, you’ll need to make two additions to your system – a database for storing your information, and a scripting language to provide connectivity from the database to your web server. Fortunately, these tools can be found as freely available open-source software projects.
Today MySQL is the most popular open source database server in the world with more than 4 million installations powering websites, datawarehouses, business applications, logging systems and more. Customers such as Yahoo! Finance, MP3.com, Motorola, NASA, Silicon Graphics, and Texas Instruments use the MySQL server in mission-critical applications.2 MySQL provides all the functionality you might need for hosting a dynamic web site.
Think of MySQL as the container for the information you wish to display on your web site. It holds and organizes stories, photos, audio and video files, PDFs and any other content you might wish to place on your web site, then provides a means to rapidly index, locate and retrieve that information and deliver it on demand.
But you need a way to have the information stored within your MySQL database to be displayed in a web browser. This is where a scripting language comes in – it provides the connection from the database to your web server. One of the most popular scripting languages available is PHP, which stands for “Hypertext Preprocessor.” It is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.3
Essentially, a PHP script tells your database “On this page, I need the score from last night’s game here; the headline here; a mug shot of our leading scorer here; the game story there and a link to the box score over there.” The database then gathers the information and hands it over to PHP. On the fly, PHP generates an HTML page with that information, which is then sent to your web browser for the world to see. This allows you to set up one template for displaying information, and what is displayed can be changed every time the page loads by having the database retrieve and give to PHP a different set of information.
A very basic tutorial on using PHP to generate a dynamic web site can be found at
php.net
While PHP and MySQL are powerful and freely available, based on their history they tend to not be the friendliest of software to install, particularly for those who do not wish to meddle with the inner workings of their machines. You’ll run across nightmarish phrases like “download the TARball and compile the source code for your particular system.” But again, help is available. Increasingly, click-and-install distributions are becoming readily available for MySQL, and easy-to-follow instructions for installing and activating PHP can be found on-line as well.
Marc Liyanage, a MacOS X and UNIX guru living in Switzerland, provides one-stop shopping for installing these tools onto your computer. Visit his web site at www.entropy.ch for an easily-installable version of MySQL which uses a standard MacOS installer package, and simple instructions for activating PHP on your system. His web site has become well-known for those looking for help with these programs, and Apple’s own developer resources direct developers to turn to Marc for installation instructions.
OK, I’ve got all of this stuff – now what?
For those of you who are now overwhelmed by the thought of sitting in front of a computer faced with the task of writing your own code, have no fears. Fortunately, there are many tools available which greatly simplify the process of using PHP and MySQL to build dynamic sites.
Already well-known as perhaps the finest professional web-site design and construction tool on the market, the latest version of Macromedia’s Dreamweaver includes powerful, built-in web application functionality. Users of previous versions of Dreamweaver already know if its ability to write Javascript for creating interactive and navigational elements; the new MX version adds the ability to connect to a MySQL database server and similarly write PHP code (as well as code for several other scripting languages and server models not covered here). You can even display your dynamic content within Dreamweaver, allowing instant feedback to ensure all is working as intended.
Dreamweaver includes a good tutorial to get you up and running with the basics of dynamic web site creation using MX. The Macromedia web site also has two very good tutorial projects for you to hone your skills.
An application to watch is pMachine, an open-source content management system (CMS) written in PHP by Rick Ellis, a self-proclaimed “Internet freak” in Los Angeles. It has many of the features one would require for running a sports information web site: separate news pages for developing sub-sections for each of your sports; a full-featured calendar module; an XML parser which likely could be tweaked to display XML-formatted reports generated by StatCrew to make posting box scores and statistics a nearly trivial process; a discussion forum to allow feedback from your fans and supporters; the ability to mass e-mail people who have registered at your site – excellent for weekly newsletters or other updates; and much, much more.
The pMachine distribution includes templates that can easily be edited using the dynamic site creation features in Dreamweaver MX, allowing you to completely customize the design and layout of your web site using powerful professional tools while still retaining all of pMachine’s functionality.
pMachine is one of many open-source CMS tools available, but while other systems may be better-suited for portal sites or user-controlled forums pMachine is becoming much more of a general-purpose, robust publishing tool. It still lacks a few minor features that would be important for operating a sports information web site, but many of those will be added in upcoming releases. It is available in a free “lite” version for personal use, and a Pro version is available for $45, which allows non-commercial personal use and use by educational and non-profit organizations. Several of the features of pMachine listed above – such as the event calendar and XML parser – are available only in the Pro version.
With these powerful tools readily available and becoming easier to use every day, the ability to easily create and deploy dynamic web applications is no longer limited to large companies with staffs of Mountain Dew-powered programmers and billing departments ready to send you an invoice for five thousand dollars. These are tools anyone can use, which brings you power limited only by your imagination.
Relevant links:
Apple Developer Connection; Internet
Developer section
Apache web server
MySQL database
PHP scripting language
Marc Liyanage’s web site
Macromedia Dreamweaver MX
pMachine
Footnotes
1: http://www.netcraft.com/survey/
2: source: http://www.mysql.com/company/
3: source: http://www.php.net
By Andy Bartlett, Bemidji State University SID, serves on the CoSIDA Technology Committee