New Efforts:
Blue Parabola, LLC
PHP'ers:
Ben Ramsey
Brandon Savage
Cal Evans
Chris Shiflett
Eli White
Elizabeth Naramore
Joe LeBlanc
Justin Thorp
Matthew Weier O'Phinney
Rasmus Lerdorf
Tony Bibbs
Zend Blogs
Zend DevZone
DC Social Media:
Aaron Brazell
Jessie X
Ken Yeung
New Media Jim
Shashi B
Social Times
Technologists:
Jimmy Gardner
O'Reilly Radar
Scott Berkun
Steve McConnell
Business/mISV:
Bob Walsh
Eric Sink
Gavin Bowman
Guy Kawasaki
Joel Spolsky
Micah Baldwin
Paul Graham
Planet mISV
Past Projects:
CodeSnipers
HOBY
Judicial Watch
mobile Fox Affiliates
mobile FoxNews.com
MyDearJohnLetter
NRTW
techRepublican
Great Tools I use:
BaseCamp
Drupal
getClicky
Highrise
phpUnit
Qcodo
Subversion
web2Project
Zend Framework
This is not the home of dotProject. It is the home of CaseySoftware, LLC. Any dotProject support questions should be referred to their support forums.
About six months ago, I started work on a small PHP project. It involved a relatively simple concept with an identical method of loading and displaying content but each set would have a custom look and feel*. It seemed liked a relatively straight-forward small-scale Content Management System with a transform layer in front.
At the beginning, I evaluated using Drupal to see how it would work for our needs. Although it did aspects of what we were looking for, it didn't seem to support the dynamic theming required. Regardless, there were a few aspects which Drupal did beautifully, so I pulled a few of those functions - properly attributed of course - and adjusted them for our purposes. A small but useful success.
Then I began on the templating side of things. There was already an effort to convert dotProject over to using Smarty Templates for theming and so I investigated that as an option. The tag/insert format felt natural after working with JSP tags and it was already in use for dotProject, so those were huge plusses. Unfortunately, it seemed like a much heavier solution than we required. With the first milestone looming, I was able to capture requirements for the next few milestones and decided against Smarty and implemented a really simple template system.
Bringing the first few sites online was incredibly simple. Each had very similar aspects and my simple templating system - let's call it "Dummy" - worked beautifully. It was easy, fast, lightweight and mostly web designer friendly. Thinking about it a bit and getting new requirements, I managed to extend it in a number of unexpected and useful ways in almost no time at all. Unfortunately, this little CMS has begun to take off and caught the eye of a handful of big names. Another few rounds of requirements, additional considerations, additional feedback, and a bit of logic and I found that I've implemented a much less flexible and less extensible version of Smarty. Don't get me wrong. It works, it's relatively efficient, and I can extend it with almost no effort but unfortunately, it's also a "Keith Original" and is not a long-term solution. So I dug back into Smarty...
After adding the libraries to the project, I tweaked my template generation and variable assignments and prepared for a world of hurt. I began with the smallest template and prepared for a screen full of errors and an afternoon of debugging. Control-R and what did I see...
My page loaded. My page didn't just load, but approximately half of the variables were populated with the correct values. Although the engine side of the system was just a shadow of Smarty, the template formats were so similar that huge portions of the site worked. Apparently, I had learned enough from Smarty so that even when I was doing it wrong, I was doing some of it right.
No, I don't recommend building your own anything right off the bat. Dig around and look at what is already available and out there. Even if something is heavy for your initial requirements, learn a bit about it, how it works, and where its weaknesses are. Who knows, you may end up in a scenario where some simple design thoughts early on could save you hours or even days of work.
* My apologies for the vagueness. Some of the sites are released and for public use and some are not. Once more of the sites are available, they will be announced here.
Template engines are an overkill
Personally, I don't particularly like template engines that use custom syntax, particularly if they implement complex abilities like loops and conditionals. Smarty is such an engine, and it's certainly an overkill (and likely a performance hog) to use a large library to do the work that natively exists in PHP.
PHP is in itself a template engine -- separation of business and presentation logic doesn't mean separation of PHP and HTML. This article sums it up most concisely.
Separating Business from Display
Thanks for the article and feedback and I do see the value of not obfuscating your templates with a pseudo-scripting language disconnected from php. Good point.. if you have to learn a scripting language anyway, might as be an actual one.
Regardless, the bulk of my effort has been to based directly on separting the business logic from the display and supporting the same content being displayed in a variety of formats. On that point, I think my efforts are in line with the point of the article.
Unfortunately, the fundamental difference between Dummy and Smarty is due to the fact that my version is based on a pair of classes with approximately 10 functions... so you're likely to be right on the performance differences.
Post new comment