CMS Design using jQuery and PHP: the core

I submitted chapter 1 of “cms design using jquery and php” yesterday.

I’ve been building and using CMSes for over ten years, and the more I do it, the more I realise that “less is more”.

In the beginning, I was writing CMSes that had absolutely every aspect of the requirements hard-coded. That made the system fast but inflexible.

Over the years, though, I started figuring ways of breaking the system up into more modular bits and pieces, that could be enabled/disabled depending on the job.

This is the essence of what “plugins” are about – you have a single core system which includes only the absolute essentials, and into that, you put whatever plugins you find necessary for the job you’re doing.

The trick, though, is in deciding what is a plugin and what is not. This is very important to figure out – if something should be a plugin, it should not be in the core, thus making he core more stable and manageable. Conversely, if you make something into a plugin which is necessary for normal use of the CMS, then it makes the system less stable.

An example of this dilemma is user logins. Obviously, you need to have user logins for the admin area to work, but you don’t need user logins on the front end of the site.

So, should user-logins be a plugin or core functionality? The solution is a mix of both – you need to create a hard-coded user login specifically for the admin area, and if you want users logging in to the front end, that is a plugin, even though they both use the same database. The difference is that the admin login area is at a defined point (when you access the admin area), while making the frontend login into a plugin allows you to place a login anywhere you want.

Anyway – over the years, I’ve whittled away at my own CMSes until I realised that the core functionality of a CMS consists of just three things:

  1. display and editing of “normal” pages
  2. user and role administration
  3. plugin management

It’s impossible to cover those three items in just one chapter, but once they are covered, that basically completes the CMS!

When you have the above three items completed in your CMS, you can then work completely on plugins, making the system stable and yet flexible.

Of course, there are some fine details (templates, UI, optimisation, DB structure, etc.) that go into completing those three items, but that’s basically it.

  1. Hi,
    What is your opinion on using frameworks to speed up the development process, I have been working with CodeIgniter recently and have found with the use of the plugins that I can integrate lots of cool features and develop a pretty good CMS in no time?
    //Gary

  2. My opinion is that people should use whatever they’re comfortable with. I know a number of people that swear by various frameworks (ZF and Pear mostly), but there are positives and negatives to everything.

    Frameworks offer quick development, but sometimes at the expense of speed and the ability to optimise the code.

    Personally, I like to use frameworks for code that I’m prototyping, and if it comes time to speed it up, I write custom code that contains /just/ the code that will be used, and not the whole toolbox that sometimes comes with frameworks.

    In the book, I’ll be advocating Smarty as a templating engine, and some Pear libraries for ease of development. Apart from that, the book is not about any particular PHP library, but more about the ideas behind how to develop and maintain a flexible CMS. The underlying server-side technology does not matter.

    btw: I’ve removed your link. Nice try, but I don’t like spam. Please don’t try that again šŸ˜‰

  3. Great post on CMSes, jQuery and PHP.
    When can we expect the book?
    Where can we read more from it… or from other resources??

    Best of luck!

  4. I’ve just submitted chapter 7 of the book, on how to create an Image Gallery plugin.

    The first 4 or so chapters describe the building of the core engine. They’re a bit long, as there was a lot to explain. I’m expecting the rest of the chapters to be shorter, as the main work has now been done.

    As for /when/ – that’s a difficult question to answer. I hopw to have the book completely submitted within two months, but this is usually then followed by “rewrites”, where Packt’s internal reviewers critique the book and ask that the author rewrite parts of it to make it more legible. This is where the “drivel” that I’ve written becomes actually readable šŸ˜‰

    I am guessing that the book will be released near the end of October or so.

    In the meantime, there’s always my first book. “jQuery 1.3 with PHP” – apart from some small points that need to be updated to match jQuery 1.4 (basically, all parameter names and values in JSON must be double-quoted), the book is still very relevant: https://www.packtpub.com/jquery-1-3-with-php/book

Leave a Reply

%d bloggers like this: