ITworld.com
  Search  
ITworld Home Page ITworld Webcasts ITworld White Papers ITworld Newsletters ITworld News ITworld Topics Careers ITworld Voices ITwhirled Changing the way you view IT

The power and pitfalls of modifying PHP-Nuke for Web programming

InfoWorld 4/13/2001

Nicholas Petreley, InfoWorld

I have a confession to make: I am an undisciplined programmer at heart. Unless someone or something provides external motivation to do otherwise, I tend to jump in and start coding a project without any formal plans. This approach usually produces code that is difficult to extend or maintain because one discovers requirements of a project only by bumping into the limitations created by what one has already coded. The end result is a continual state of rewrites.

On this topic

That makes me somewhat of a hypocrite, because I get annoyed with those who do likewise. That has been the case with PHP-Nuke. I've been modifying PHP-Nuke 4.4.1a (www.phpnuke.org) for use as the publishing system for the VarLinux.org site (www.varlinux.org) and for Petreley.org, which is a project I'm doing in my off hours. PHP-Nuke is a Weblog publishing system written in PHP (www.php4.org) with MySQL (www.mysql.com) as the database back end.

To be fair, the programmers of PHP-Nuke might not have been deliberately disorganized with their approach, but they simply may have fallen into some common PHP traps. Although it is entirely possible to use PHP to build a modular Web site, the language tends to discourage modularity because PHP code integrates right into HTML.

This is what makes PHP simultaneously irresistible and prone to disorganization. It is irresistible because you can use PHP to crank out MySQL data and turn it into a page of information more easily than just about any other Web programming system. PHP is prone to disorganization because the HTML opening formatting tags you create inside a PHP function are often completed by other PHP functions. This means that every time you change the opening formatting tags, you have to find every occurrence where the closing tags must match. The most common format tags that get you into trouble are the table, row, and data tags. If you don't handle these tags properly, many of your page elements will be scattered into places you don't want them.

One way to get around this is to create a function for every combination of opening and closing tags. Then you only have to maintain these functions, not the formatting within other functions. You can see in the current version of PHP-Nuke that the coders tried to implement this in some cases, but it was probably too late to revamp the whole project without starting over, which is what they did. PHP-Nuke 5.0 is on its way, and it is built almost from scratch.

The worst news is that I am unaware of any HTML syntax checkers that can process PHP pages to check your work. Indeed, I wouldn't expect to find any because it would be extremely difficult for a checker to anticipate every combination of functions and code and process every conditional statement to see which tags get used when.

If you know of any work being done on this, by all means pass on the info and I'll publish it here.

Anyway, these problems were exactly what I encountered when I began modifying PHP-Nuke themes and PHP-Nuke itself for use with VarLinux.org. There are many sample themes for use with PHP-Nuke, and the ones I chose to modify for use with VarLinux.org were fairly sloppy.

Unfortunately, I checked my work using only the KDE Konqueror browser and Mozilla 0.8, and occasionally Opera for Linux. All of these browsers rendered my site beautifully in spite of the fact that the theme code was riddled with errors. It was only when Netscape users reported messy rendering that I began to look for these errors. I found dozens scattered throughout the themes and the PHP-Nuke code itself. (Granted, I probably introduced many of these errors myself while modifying PHP-Nuke for my needs.)

Fortunately, the folks who did PHP-Nuke are releasing a new version soon which probably addresses many of the modularity issues I encountered.

In summary, I recommend taking a good long look at PHP-Nuke, both the old and new versions. Feel free to download my modified version from the VarLinux.org Web site, if only to have a good laugh at the work I've done. I'm also planning on looking at a very promising product called LXP (www.linuxports.com) as an alternative.

I recommend having a look, yourself. I'll get back to you after I've had the software in my hands for a while.

Another publishing system worth examining is ez-Publish (developer.ez.no). I had trouble with this software and gave up on it, perhaps too quickly. But it appears to be extremely feature-rich and powerful. I've also found it impossible to get started with CMF-1.0 (cmf.zope.org), the content management system for Zope (www.zope.org). But it looks nice, it looks very nice. I can't help but wonder what it would be like to use it. Yet another couple to look at are thatware (www.thatware.org) and squishdot for Zope (www.squishdot.org).

Finally, I highly recommend studying many of the PHP-Nuke themes that are available on the PHP-Nuke Web site. I'm not an HTML guru by any means. I can barely grok the concept of nested tables after messing with the themes for my site. But I learned an awful lot about how to use tables to create certain visual effects simply by trying to reproduce the effects of the existing themes and then correcting all the mistakes I had made in the process.

Indeed, I'd say that working with PHP-Nuke along with the themes that are available make one of the best tutorials on PHP and HTML formatting I've ever seen.

Well, unless I encounter some new challenges for the VarLinux.org site (www.varlinux.org), that about wraps up my experience with it for now. Please feel free to visit the site, add your comments and suggestions, and report any bugs you find.

Nick Petreley is the founding editor of VarLinux.org (www.varlinux.org). Reach him at nicholas@petreley.com.




Sponsored Links

Multi-Core Test Results In Virtualized Servers
Check Out The Latest Xeon® Performance Results. Virtualized Servers vs. Non-Virtualized Servers.
FREE virus, spyware & adware scan
Find the malware your AV missed with the Sophos Threat Detection Test.
Replace your mainframe 4GL and save with Spectrum Writer.
Powerful, easy 4GL. Custom reports. Export files for PC programs. Web reports. Download free trial.
Improving the View with IP Videoconferencing
New videoconferencing technologies are poised to benefit the enterprise.
Used and Refurbished HP ProCurve Switches
Lifetime Warranties, Professional Testing & Shipping on all HP Equipment Purchases!
» Buy a link now

Advertisements
Sponsored links
Bring harmony to your mix of UNIX-Linux-Windows computing environments
Top 5 Reasons to Combine App Performance and Security
KODAK i1400 Series Scanners stand up to the challenge
Locate Hidden Software on business PCs with this free tool
 Home   Application Development  Web development  Web development platforms  Web development tools
www.itworld.com    open.itworld.com     security.itworld.com     smallbusiness.itworld.com
storage.itworld.com     utilitycomputing.itworld.com     wireless.itworld.com

 
Contact Us   About Us   Privacy Policy    Terms of Service   Reprints  

CIO   Computerworld   CSO   GamePro   Games.net   Industry Standard   Infoworld   ITworld  
JavaWorld   LinuxWorld  MacUser   Macworld   Network World   PC World   Playlist  

DEMO   IDG Connect   IDG Knowledge Hub   IDG TechNetwork   IDG World Expo  

Copyright © Computerworld, Inc. All rights reserved

Reproduction in whole or in part in any form or medium without express written permission of Computerworld Inc. is prohibited. Computerworld and Computerworld.com and the respective logos are trademarks of International Data Group Inc.