PHP (LAMP) CMS

Authors
  • avatar
    Name
    Paul Bonnette
    Twitter

Back in 2003 WordPress would not exist for another 8 years. It was obvious to everyone that building websites was painful. Anyone could use Dreamweaver or FrontPage to build static HTML pages and upload them to a hosting company, but there were many drawbacks.

  • Inconsistency - It was difficult to get a consistent layout between pages. It was common for menus not to match between web pages.
  • Software Required - Customers usually needed to own and learn FrontPage or Dreamweaver.

Something was needed, but what? Enter server-side programming. PHP popped up about this time to fill in the gap. It was easy to learn, flexible and fast.

I started experimenting with building my own system. My final design was fast, light and powerful. WordPress and other CMS are powerful but I have yet to see one which is as fast and light.

Design & Philosophy

Most systems start with a philosophy or design concept. Sometimes it's a great idea. Sometimes it's a disaster.

My idea was to take the category structure which I used in building inventory control systems (like my ARAMARK's ACTFAS system) but add content to the hierarchy.

Epiphany

This actually made a great deal of sense, for a number of reasons.

  • Categories are hierarchical.
  • The browser renders pages based on the DOM, which is hierarchical.
  • Therefore the structures should be compatible.

Categories

The second insight is that most catalog websites (with a shopping cart) already have large category tree-like structures. The website itself could be viewed as an extension of that hierarchy.

How about Layout?

It occurred to me that layout, or how a page is drawn, could be based on the category we are in. If you are in the "catalog" then we draw products. If we are in "Articles" then we draw a layout fitting for articles.

The power of inheritance

Another design feature which I have found very useful in my applications is the concept of inheritance. It is amazingly powerful. By default things work one way but when you change an ancestor all children of that structure change their behavior.

Putting it together

Now I put these concepts together and what I built was a CMS system where:

  • Speed was king! I always optimized for speed.
  • Every page, every URL, everything in the website had a category which told the system it's dynamic template.
  • Templates were either directly set in a category or inherited from parent directories.

Blocks - Taking it up a notch

So now the engine was fast and had dynamic layouts. But how to implement it?

I build a system of block which could be assigned to a category or an article.

A set of blocks belonging to an article creates a layout. This could be assigned to any category.

Inheritance means once a layout was assigned all categories under that category knew their layout and could draw themselves.

This system worked in milliseconds and was lightening fast.

Further Optimization

  • Styling and Javascript was appended to each page dynamically.
  • Styling and Javascript optimization and compression was built in.
  • Image optimization was built in, including automatic sizing and caching.
  • Built-in security sanitizes all variables automatically.

Final Specifications

These specifications grew over time as business grew. Eventually it became:

  • Build a framework to handle large, dynamic websites quickly.
  • Content could be templates (like a product catalog or articles) or custom scripts (like a shopping cart).
  • Build a custom shopping cart with address verification, credit card processing and more.
  • Track orders, filling orders with a barcode scanner, inventory adjustments as you fill an order, back orders, etc.
  • Handle customer notifications.
  • Handle inventory.
  • Handle assemblies (products built out of other products).
  • Handle product processing (sent out for processing).
  • Handle Purchase Orders.
  • Track coupons by category, product, shipping, etc.
  • Barcode everything.
  • Make it easy for any employee to build an assembly.
  • Make packaging consistent, even for novice employees.

Speed Tests

  • Final speeds show page renders with data as fast as 23 milliseconds:

If you think that's fast check out the results with caching:

It's faster because MySQL/PHP remembers the queries involved and can spit out an answer that much faster.

So you might wonder how fast can this run without any data, just fetching the category structure, template, render the blocks involved, compress the CSS and Javascript and send back the web page?

That's right. 4ms. Take that WordPress!

Conclusion

The PHP(LAMP) framework I developed is amazing and still in use today. However, strongly recommend that new PHP projects use Laravel as framework.