Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

PHP5 CMS Framework Development

samzenpus posted about 6 years ago | from the read-all-about-it dept.

PHP 72

Michael J. Ross writes "Most Web developers are familiar with one or more content management systems (CMSs), and how they can be used to create Web sites more efficiently than by hand. These developers may have deep knowledge of how to install, configure, customize, and extend a CMS. But far more rare is knowledge of how to develop a CMS of one's own, and the programming considerations required to do so successfully. These are the main themes of Martin Brampton's book PHP5 CMS Framework Development." Read below for the rest of Michael's review.This title was released by Packt Publishing on 6 June 2008, under the ISBNs 1847193579 and 978-1847193575. In addition to an appendix on packaging Aliro extensions, the book's material is organized into 14 chapters, covering various CMS topics: overall CMS architecture; users and administrators; code organization; user sessions; databases and data objects; access control; supporting extensions of the CMS; data caching and handlers; menus; support for multiple human languages; presentation services; miscellaneous services, such as file handling, e-mail delivery, and admin functionality; error handling; and how to manage many types of content.

At the very beginning of the preface, the author notes that "This book guides you through the design and implementation decisions necessary to create a working architecture for a PHP5-based content management system." Martin Brampton is qualified for this task, given his strong background in CMS development, having served as the leader of the Mambo development team during a critical period of its evolution, and later creating his own CMS, Aliro. It should be noted that the book does not assume any prior knowledge of CMSs in general or Aliro in particular, although in most respects this work is very much a case study of the architecture and design decisions of that specific CMS. However, the book does assume a solid understanding of PHP and object-oriented principles.

All of the code samples come from the Aliro content management system, of which Martin Brampton is the project architect. On the book's Web page, the publisher has made available links to purchase the electronic version of the book, to download the source code, to post feedback on the book, to ask questions, to read the table of contents and media reviews, and to download a sample chapter (Chapter 6: Access Control). The only problem with these offerings is that the source code is not organized by chapter, but instead comprises the source code for Aliro. (The publisher's page labels it as 2.6 MB, as of this writing, but Aliro is about three times that size.) Consequently, readers who want to find specific code should search through the files using their favorite programmer's editor.

The author devotes the first chapter of the book to presenting his perspective on the advantages of using CMSs for site development, the required and the desirable features of a CMS, and some system management issues. Also covered are reasons for using PHP 5, its object-oriented capabilities, XHTML, and the Model-View-Controller pattern. He then discusses sundry topics on site hosting, JavaScript, site security, and CMS-specific terminology. Many readers may find interesting the arguments for separating system administrative access (as done in Aliro, for instance) versus integrating it with the regular site interface and using access control to restrict non-admin users (as done in Drupal, for instance). The chapter concludes with a summary, which for this and the following two chapters, may be of value to some readers, since these chapters are more narrative than the others. But the chapter summaries that follow, for the more technical material, could be disposed of in future editions, since readers will seek within the chapters for the information covered.

Throughout much of the history of the Web, one of the most problematic aspects of site development has been the management of users and administrators — especially with CMSs causing the two distinct groups to be splintered into a spectrum ranging from anonymous visitors with no privileges, to site administrators with full privileges, along with authorized users, content contributors, and content editors. In his second chapter, the author examines the challenges of user authentication, password storage, SQL injection, and other access issues. He proposes a framework solution and also a division of user data into two tables, as done in Aliro. He describes some of the key code utilized within his CMS (naturally, the full code is obtainable since Aliro is an open-source project). Chapter 4 addresses an area that frequently mystifies new PHP programmers — namely, how to create, utilize, and protect user sessions. Thus, this material should have been placed immediately after the second chapter.

The third chapter is devoted to the critical architectural issue of how to best organize one's code. Given that the two aforementioned chapters — dealing with users and sessions — both contain a fair amount of code, this chapter's meta-information should have been presented prior to both Chapters 2 and 4. Nonetheless, the author covers such topics as inclusion and the singleton pattern. He makes a strong case for favoring small classes, stored in separate source code files, and only loading them when needed, using PHP 5's autoloading capability.

In Chapter 5, the author spends some time exploring some of the key issues for storing data in a CMS framework, including dependency upon a particular RDBMS, item counting and ordering, database security, SQL validation, PHP exception handling, and the techniques that the author used for effectively dealing with these challenges when developing his own CMS. The first portion of the chapter, which essentially presents the problems, is fairly disjointed compared to the other material; the remaining portion of the chapter, which covers all of the solutions, is certainly more complete.

The next two chapters of the book, 6 and 7, are focused on topics more specific to CMSs: access control, and extensions to the CMS (components, modules, plug-ins, and templates), respectively. Chapter 8 explores caching and cache handlers, as well as the advantages of using them. The ninth chapter, on menus and page handling, is quite specific to Aliro, and thus will prove disappointing to any reader who hopes to get ideas for their own menu code. In contrast, Chapter 10 should be of interest to anyone who would like their Web sites to be usable and appealing to Internet visitors who do not read the single language of any site not designed for foreign use. Character sets and language extensions are discussed, as well as a third-party solution that is available.

For many years there has been an ongoing debate among PHP developers, as to whether or not to use templating systems as a way of separating presentational content from business logic and functional content. At essence is a question pondered by most if not all dedicated PHP developers: What is the easiest and yet most maintainable way to deliver one's XHTML code, using PHP? This is just one of many subjects discussed in Chapter 11, "Presentation Services," which is easily one of the most compelling and wide ranging sections of the book. Chapter 12 addresses the topic of allowing a site to interact with other services, such as those for WYSIWYG editing and XML parsing. Error handling is explored in Chapter 13, including errors within application code — from PHP itself and from business logic problems — and the database. The book's final chapter covers what the author refers to as "real content," by which he means the content contributed by administrators and users to a CMS, such as articles, comments, forum postings, calendar entries, and other items. The book's single appendix explains how to package an Aliro extension for release, and would most likely be of no interest to anyone not creating such extensions for distribution.

The book has few weaknesses. Occasionally the author will state something that could be misleading to the beginning programmer. For instance, on the first page of the first chapter (not an auspicious start) he refers to the World Wide Web as a markup language. On the contrary, the markup language used to create the Web, is HTML. As we are seeing more frequently in technical books, the writing itself could use a bit more editing — such as hyphens missing from adjective phrases in many locations in the text. Lastly, some programmers may find the author's GNU style of code formatting rather bizarre in appearance.

Overall, PHP programmers who are committed to following best practices in site security, code organization, database usage, and other important factors in any site development, will find plenty of ideas in this book to consider and possibly apply to their own coding. Readers who simply see the book's title, and perhaps browse quickly through its contents, may get the false impression that the information would only be of value to someone who wants to create their own CMS from scratch. The book may be of considerable value for such an effort, but it offers more than that. Many of the most critical issues in architecting and implementing a CMS, apply to non-CMS Web sites as well. Also, as a veteran of software development, the author conveys worthy advice on development practices — such as in the first chapter — regardless of the chosen computer language. In addition, for the growing number of developers who are exploring the inner workings of CMSs — usually with the idea of extending their functionality by writing modules — an appreciation for how the creator of a CMS thinks, could be helpful. Ideas are illustrated throughout with sample code — none of them excessive in length. PHP5 CMS Framework Development offers lessons in PHP 5 object-oriented programming and Web site development that goes beyond CMSs and Aliro.

Michael J. Ross is a Web developer, writer, and freelance editor.

You can purchase PHP5 CMS Framework Development from Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×


Sorry! There are no comments related to the filter you selected.

Great Book. (5, Funny)

Anonymous Coward | about 6 years ago | (#25387181)

I highly suggest the author's previous book: Reinventing the Wheel.

Re:Great Book. (4, Informative)

FunkyELF (609131) | about 6 years ago | (#25388249)

I highly suggest django, 10 lines of code gets you a working CMS with authentication, admin interface, permissions, syndication, pagination, etc.

Re:Great Book. (1)

mweather (1089505) | about 6 years ago | (#25388359)

Actually, it's less than 10 lines of code if you use flatpages.

Re:Great Book. (1)

ibbie (647332) | about 6 years ago | (#25390365)

Provided that you only need the functionality that flatpages provides, that's true.

Don't get me wrong, I love the heck out of flatpages, and in my experience it seems to meet at least 50% of my clients' needs (which is the intent of contrib apps - to take care of common use cases).

But I often run into clients who need more than that bare functionality. Usually I leverage flatpages by inheriting its model into an abstract base class (saves a bit of typing), and extend the heck out of it from there.

Again, it's still way better a head start than writing it from scratch; just don't assume that the contrib apps will (or worse, that they should) solve every need, want, and desire.

After all, that's what pinax [] is for. (;

Re:Great Book. (1)

Xest (935314) | about 6 years ago | (#25396081)

...and minus a massive amount of customization

This is the problem, whilst things like Joomla are fantastic to get you up and running near instantly, they're also useless if you want to step away from their way of doing things with regards to categories/sections and such.

There isn't a one size fits all CMS out there. You make compromises and choose which gives you the best fit to your problem but if you end up using one that is quite low level (well, probably a framework rather than a CMS e.g. Zend) to give you the flexibility you need whilst still missing some points due consideration really has to be given to building one yourself.

Re:Great Book. (1)

h4rm0ny (722443) | about 6 years ago | (#25396901)

I get what you're saying but I've tried developing with both Django and Joomla (and others). Django is far beyond any other competitor I've tried. It's an absolute joy to work with and extremely well thought out. You're right of course when you say that one-size doesn't fit all, but Django is very, very good. Certainly beats the Hell out of anything I've seen done with PHP frameworks.

Re:Great Book. (4, Insightful)

Tumbleweed (3706) | about 6 years ago | (#25390445)

If people didn't occasionally reinvent the wheel, we'd still be using those old ones made of stone.

Framework + CMS (1)

truthsearch (249536) | about 6 years ago | (#25387455)

...having served as the leader of the Mambo development team during a critical period of its evolution...

The few times I looked into Mambo code it was horrible. Hopefully his Aliro code is much better.

When it comes to CMSs that I'm building myself, I prefer to use a custom or generic framework and build the CMS completely separate on top of that. As mentioned in this review, there is so much functionality that's generic to all web applications, like basic security [] . So using a solid base it makes more sense to build the CMS functionality separately.

Re:Framework vs CMS (2, Insightful)

tayhimself (791184) | about 6 years ago | (#25387929)

I would like to frame the question as framework versus CMS. When would you choose a CMS for a web site rather than a framework?
In particular, is there really a need for CMS's these days for flexible web site development when there are very capable PHP frameworks out there (Zend, Symfony, cake, etc). I have used the Symfony framework for database driven intranet sites, but I have never used a CMS other than to put up a blog like thingy. Of course, these days many frameworks contain simple CMS's.

Re:Framework vs CMS (1)

FLEB (312391) | about 6 years ago | (#25388495)

I use CMSs, because I'm a designer and primarily front-end developer. While I can read and write PHP, as well as a few other languages, I lack the programming theory and education necessary to dive into rolling my own client-ready CMS without taking excess time or making something sub-par in performance and security. I work in a small marketing firm as the lone "web guy", and things just have to get done. For many others, I imagine they're in the similar situation where they want to get a personal or self-run site up, and can't, or don't want to, bother with the back-end mechanics.

That said, I have been looking at frameworks-- CodeIgniter, in particular-- as an addition to my arsenal, as most CMSs seem to come lacking that one specific thing you need to do.

Re:Framework vs CMS (1)

Teilo (91279) | about 6 years ago | (#25388497)

Many web applications can benefit from CMS functionality, particularly if they are public-facing and part of a company's product. Personally, I like to start with a strong and flexible framework, on top of which I implement a very basic CMS system, that can be used to allow customers to manage all their own content and even the CSS and layout of the site, without requiring them to know anything about the application functionality except where it "plugs in" to the page content.

That said, some applications do not at all fit that model and do net need CMS functionality. That is why I prefer to start with a good framework, not a CMS.

Re:Framework vs CMS (3, Informative)

truthsearch (249536) | about 6 years ago | (#25388871)

At the start of most projects I ask myself if there's an open source application that already exists that fits the requirements very closely. If the requirements are well written (actually, unlikely to significantly change), and an existing CMS fits almost perfectly, I'll use a CMS. But if it looks like additional modules won't do, and I'll have to hack the internals significantly, then I go with a framework.

My company's custom framework gives me something like 80% of what I need to build a simple CMS. Clients are pretty demanding about tweaks. So I've found I'm usually better off building a custom CMS on top of the framework so it's easy to make more custom edits for the client later.

Re:Framework vs CMS (0)

Anonymous Coward | about 6 years ago | (#25409821)

If your looking to not start from scratch and still use a framework you might wanna checkout Wildflower a CMS for cakephp. They are in the process of making it a plugin. Because it is built on a framework extending it is easy.

Additionally, if you don't need to go for open source, (gotta pay for this one) Expression Engine 2.0 should be coming out soon as well, this is built on the codeigniter framework.

Re:Framework + CMS (1)

cl0s (1322587) | about 6 years ago | (#25389173)

I agree with you. I have a basic CMS that I built on top of CakePHP that handles groups, users, permissions, comments for whatever model (comments for audio section or blogs, etc all in one controller) and a blog all using built in Cake functionality (Authentication, ACL, CRUD, Pagination, etc.), anything else is a lot easier to add within that framework than lets say, Wordpress. For example if you want to add forums where the users are the same for the blog comments, or an audio section or photo gallery. If you know you're just creating a straight up blog and you're not a developer though your better off going the Wordpress route though.

Re:Framework + CMS (1)

cl0s (1322587) | about 6 years ago | (#25389275)

Sorry I ran off I understand Wordpress is not necc a content management system, more something like Joomla. Another thing thats turns me off about the CMS is the speed, they're just a lot slower than some clean code that does exactly what you want and still has flexibility. A lot of out of the box web apps suffer from this though as they try to be as flexible as possible so stuff that should be coming out of a config or something like that usually ends up having to get read out of a database every time.

Amen (1)

omuls are tasty (1321759) | about 6 years ago | (#25389437)

While reinventing the wheel is generally not a particularly wise thing to do, building a new CMS is often one thing where it makes sense.

I have a friend who owns a company specialized in customizing Joomla (a fork of Mambo), and I occassionally do some work for him. His clients are abound. People are often lured by the seemingly low price of a Joomla deployment. PHP/MySQL hosting is everywhere and it's cheap. Joomla itself is free, and it has a huge number of extensions (or "components" in parlance) for different tasks. But most often, these things don't do exactly what the client wants.

And that's where it starts to get ridiculous. The Joomla code itself is, as you point out, nothing short of horrible, and attempting to extend it is a nightmare. The quality of components is generally not much better, and they often step on each other toes. And finally, leveraging a framework tends to be difficult when you have Joomla running, so you have to write most custom code in vanilla PHP. In the end, the time and necessary costs amount to more than a custom-built CMS sitting on top of, say, Django or Rails or Turbogears - usually for a (technically) much worse website

Re:Framework + CMS (1)

skelly33 (891182) | about 6 years ago | (#25394041)

"The few times I looked into Mambo code it was horrible."

Same here - I've done several CMS applications as Mambo/Joomla components (extensions of sorts, for the uninitiated) over the years and finally became so fed up with the underlying code base, the restrictiveness, the little-to-no future-proofing by design that I wrote my own basic framework to link in my custom components and deleted Mambo/Joomla entirely - and never looked back. I only use one DB table from the original installation because I was too lazy to rename it: mos_users (stores user names and password md5's for logins). I wouldn't put much stock into this guy's evolutionary thinking...

I'm a bit confused (4, Funny)

conner_bw (120497) | about 6 years ago | (#25387587)

So it's a howto on how to build a CMS like Aliro? Thus, propagating Aliro? A CMS I never heard of until today?

I mean, lets assume I read this book. I then start writing my own CMS. After a few weeks of trying, I kick myself. "Aliro already exists, why don't I use that?" Conveniently enough, I just put in time to learn Aliro coding practices and can now quickly contribute to the project, thus solidifying Aliro's base.

I don't remember where, but I recently read that there are job listings for WordPress developers. The article stated that WordPress has become so ubiquitous that human resource departments now list it as development platform in their solicitations. PHP experience be damned. So, basically a very successful self perpetuating marketing campaign.

Yes, I'm a bit sour because I'm part of the re-inventing the wheel with my own CMS [] crowd, too. Had I seen this book 6 months ago I might have picked it up. But now, I'm a bit suspicious especially since I could probably learn as much by just looking at Aliro? Which I will now do because I just now heard of it?

Re:Your Slashvertisement (1)

bendodge (998616) | about 6 years ago | (#25387717)

sux0r looks neat, but it's horribly ugly. True, serious webmasters can make their own skin, but you need a good default if you want to get anywhere.

Re:Your Slashvertisement (1)

conner_bw (120497) | about 6 years ago | (#25387769)

Ya, it's true. I need help in the not-ugly department. I can work from a photoshop mock-up if anyone wants to help me.

Re:Your Slashvertisement (1)

Achromatic1978 (916097) | about 6 years ago | (#25390995)

And no offense, but if he expects it to gain traction, perhaps 'sux0r' wasn't the best name...

Re:Your Slashvertisement (0)

Anonymous Coward | about 6 years ago | (#25393831)

I like the name. It's funny. I don't see how it's worse than any other made up word. (Google, Cuil, Slashdot, Yahoo! Baidu, Drupal)

Of course, in a superficial world, it's titles, not ideas or skills, that matter. And the project certainly isn't mocking that! No sir.

Re:Your Slashvertisement (0)

Anonymous Coward | about 6 years ago | (#25403445)

looks neat, but it's horribly ugly

Um.. hello?

Re:I'm a bit confused (0)

Anonymous Coward | about 6 years ago | (#25392931)

Get it here [] .

This is great (-1, Troll)

cbellh47 (1357013) | about 6 years ago | (#25387599)

This is great. I just chatted with one of the developers named Irus for a new web site called IMedix over at []

Its tools like this that will make the internet a good thing, when its focus is in helping people instead of trying to exploit them.

The two guys who designed this site have done such a wonderful job getting all the bugs out and making all their features work flawlessly. That's what customers want. I don't know what kind of web development tool they used, but it really works. It took them working night and day for quite a number of weeks getting all the features integrated and functioning properly. Development tools can revolutionize the way internet web applications are enginneered from their inception through design, and testing, to make the new user experience pretty comfortable the first time they log into it.

This IMedix thing is kind of novel. Its number one purpose and focus is on helping people help themselves and help each other with common problems that can range from heart disease, and diabetes, to depression and alcoholism. You ask a question and get answers. You read what others have asked, The question and answer format of learning is as ancient as Aristotle. You can't beat it. In today's world, you may not have the luxury of talking to your doctor at length oabout a medical question or you may have more questions that you would like to ask but don't want to pay for another office visit just for that. This kind of a forum is just right for that.

So what I am trying to say, is that a tool such as the one in this article, if out into the right set of hands, it can yield some extraordinary humanitarian results. I would call that patriot or even heroic.

CMS, huh? (1)

fishbowl (7759) | about 6 years ago | (#25387687)

* looks up, notices slashdot headline, skims article.
* shrugs.
* goes back to developing Drupal module.

Re:CMS, huh? (3, Insightful)

Skadet (528657) | about 6 years ago | (#25387825)

As a senior developer in a pretty well-known (to those who run in Drupal circles) Drupal shop, this book is relevant to my interests. After developing in Drupal for a while and releasing contrib modules, I think the next step in my Drupal learning curve is core architecture and understanding why choices were made -- "why go for role-based permissions rather than an abstracted administrative layer?" and so forth.

I'd use this book not so much to start Yet Another PHP CMS (tm), put to perhaps acquire a deeper understanding of the involved bits. That, in turn, leads to core patching, and then to development for HEAD.

Not thinking things through is, imo, one of the top time-wasters in any project -- php or otherwise -- and this book seems as if it'd help in that regard.

Re:CMS, huh? (1)

steverar (999774) | about 6 years ago | (#25389037)

check out it may save you time and get you more functionality than you could do yourself in much less time

Re:CMS, huh? (1, Informative)

Anonymous Coward | about 6 years ago | (#25391731)

You're probably right that this is the true value of the book, but the book should probably acknowledge that fact by making it non-specific to any one programming language.

A book on CMS design that covers modeling, permissions, extension points, non-browser access (WebDAV, Web Services, etc) and all the other issues that are pretty common across all CMS implementations could be pretty valuable. The author could even make code samples in PHP available on his website so long as he doesn't compromise the book by making it too implementation-specific.

But by tying it to PHP, it's going to be difficult for people to look past the implementation details to find the high-level concepts. And given that the chosen language is PHP, the intended audience is not the kind of programmers that are looking for high-level concepts and lessons learned. As such, this book is likely to spawn a whole new generation of YAPCMS, as you put it, which will no doubt offer almost nothing new beyond what's available from the current batch of CMSs.

/sarcasm-mode And we all know that if there's one thing that's missing from this world, it's a LAMP CMS implementation whose name sounds like a word made up by a 3-year-old child.

How to write GOOD code? WTF? (5, Informative)

Czaries (980959) | about 6 years ago | (#25387889)

I just took a look at the Aliro code in SVN [] , and I have to say... It looks like the same spaghetti shit code that's so popular in the rest of the PHP community.

There are multiple class definitions per file, HTML output directly in functions within the classes, no clear modular structure that I would expect in a good CMS, the list goes on.

And before I get flamed horribly - Yes, I am a PHP developer. I code with PHP every single day for both work and pleasure. But the code I just looked at shows none of the good parts of object-oriented design. This code and CMS is not doing the PHP community any favors.

Re:How to write GOOD code? WTF? (1)

FunkyELF (609131) | about 6 years ago | (#25388293)

I know the PHP language itself encourages that. Also the fact that it is easy to configure a web server and just throw in your <?php ?> anywhere you like.
But aren't there frameworks available that force you to separate models and views?
Is there nothing like django but for PHP?

Re:How to write GOOD code? WTF? (1)

Teilo (91279) | about 6 years ago | (#25388565)

Yes, there is. CakePHP or Symphony.

Re:How to write GOOD code? WTF? (1)

Teilo (91279) | about 6 years ago | (#25388577)

Or rather: symfony

Re:How to write GOOD code? WTF? (1)

BitHive (578094) | about 6 years ago | (#25388585)

There are projects like CodeIgniter and CakePHP which attempt to take the best practices of projects like Ruby on Rails and Django and reimplement them in PHP. The problem with this approach is you're still left with all the awkwardness that is PHP. No anonymous functions, no closures, stupid argument lists, etc.

Re:How to write GOOD code? WTF? (1)

lysergic.acid (845423) | about 6 years ago | (#25392951)

isn't PHP supposed to include closures [] soon [] ?

i don't know much about closures but that's just what i've read while researching closures in PHP. in what kind of situation would you specifically need to use closures? couldn't you still create bound variables through nested or recursive functions? or do closures serve a more explicit purpose that cannot be achieved any other way?

also, what language would you recommend for web development that are more robust than PHP?

Re:How to write GOOD code? WTF? (0)

Anonymous Coward | about 6 years ago | (#25394077)

From the perspective of "guy who passes functions around as arguments in javascript", rather than hard-core CS-theory-guy...

PHP doesn't really need that very much. It already has sufficient flex for the special cases.

Plus, there's always implicit evaluation, where $obj->$meth($a) calls $obj->foo($a) when $meth=="foo".

Re:How to write GOOD code? WTF? (0)

Anonymous Coward | about 6 years ago | (#25394029)

I would highly recommend the Zend Framework MVC architecture.

Of note:


It resembles JSP/Servlets, really. By default (it's very customizable) going to http://site/controller/action runs the function Controller::Action() with request/response objects. Your action can then populate data for Zend_View to manage, which (again, by default) uses .phtml files which is plain-old-php structured to display based on data your controller pushed in.

The nice thing is that ZF is very a-la-carte: When designing your MVC system (or even just using it's extra libraries) you can deliberately choose to mix and match the parts you want instead of being locked in to a rigid framework.

Cut the crap. (1)

Qbertino (265505) | about 6 years ago | (#25391099)

There are multiple class definitions per file, HTML output directly in functions within the classes ...

Chill. There is no silver bullet and no free lunch. Since you're bickering about HTML in the PHP code I gather you would rather build a templating system on top of PHP - which is so pointless, it's silly, as PHP itself *is* a templating language. That's where it comes from anyway. And most PHP crews have noticed that by now (Thank God). Except maybe for some Smarty hardcases that is. Kill one for me if you see one. ;-)

A Web-CMS and/or Framework is there to take the gruntwork away, and if you pick a current day CMS that has 5+ years with 30+ coredevs on its history and don't like the code, chances are you haven't understood it and what it is meant to do in context of the entire stack. Go on and build your own then - halfway through you'll run into the problems all others had back in 2001 and end up with the same mess others started off with. Only that they cleaned theirs up allready.

Bottom line:
It appears you haven't done much non-trivial web developement, otherwise your tone would be a tad milder.

Re:Cut the crap. (1)

omuls are tasty (1321759) | about 6 years ago | (#25392891)

Since you're bickering about HTML in the PHP code I gather you would rather build a templating system on top of PHP - which is so pointless, it's silly, as PHP itself *is* a templating language

If I only had a dollar for each XSS vulnerability introduced by the lack of escaping template values automatically. I've been guilty of that myself, more than once.

A Web-CMS and/or Framework is there to take the gruntwork away, and if you pick a current day CMS that has 5+ years with 30+ coredevs on its history and don't like the code, chances are you haven't understood it and what it is meant to do in context of the entire stack.

I envy you. I take it you've never seen Joomla code?

Re:Cut the crap. (0)

Anonymous Coward | about 6 years ago | (#25394107)

I assume you are talking about Joomla 1.0.

The developers made a minor update in Joomla 1.5 where they only rewrote the worst parts of Joomla 1.0

The worst part turned out to be all lines of php.

Joomla 1.5 has a fairly nice MVC framework that runs a cms much faster than cake.

Vtiger CRM is looking at rewriting vtiger 6.0 with the joomla MVC.

Re:Cut the crap. (1)

Czaries (980959) | about 6 years ago | (#25399571)

It's amazing how you automatically assume I'm using some template language or something. I'm not talking about removing PHP code completely from HTML, I'm talking about HTML that is tied directly to the core functionality. I'm talking about the separation of responsibilities. You have obviously never used an MVC framework, or this would have been quite clear to you.

When HTML is used in a core function, the display can never be altered without changing the base class. That is a HUGE no-no. The display should be separated from business logic so that it can be changed independently of it.

I too hate dedicated template languages for the same reason you do. PHP itself is a template language, and I don't use Smarty of anything else. But I DO separate the HTML/template display code - the "View" - from the business logic, and that's what I was ranting about.

Bottom line:
I've worked on a TON of very large projects, and that's exactly why my tone is NOT a tad milder. This is a big issue that will seriously affect the flexibility of the CMS.

Re:How to write GOOD code? WTF? (1)

aliro (1388571) | about 6 years ago | (#25423089)

As you seem to be seeking a reputation as some kind of authority on PHP, might I suggest you adopt a more considered approach, and use less intemperate language?

It's not clear that you actually know what spaghetti code [] is. I was already writing structured code when Djikstra's seminal article "Goto consider harmful" was first published.

Many Aliro classes exist in their own files, others are logically grouped. This is an implementation and convenience issue. A whole chapter [] of my book discusses the complex questions to do with XHTML generation.

Only three lines of Aliro code exist outside classes and functions, and the latter are used only where it is inescapable. By and large, the core classes are tightly logically focussed, such as aliroSession which, amazingly, deals with sessions. Not all of the code in Aliro is at the same level of development - it is a practical project that has a history and antecedents.

Your own published views suggest that you are in danger of embracing a too technical conception of OO that undermines the benefits. And I think you place too much reliance on the widely misunderstood notion of patterns. I give reasons for my view in my book, rather than just making arrogant assertions.

Incidentally, I find it hard to take seriously a PHP expert who can write a line like:
if($feedContent && !empty($feedContent)):

I'm interested in constructive discussion, even if it is critical of my published work. But this isn't remotely constructive, nor even well informed.

Developing My Own (1)

SmarkWoW (1382053) | about 6 years ago | (#25387935)

I'm currently in the process of developing a custom CMS. As far as the initial product I'd say I'm 80% or so done. It has definitely been the most extensive PHP project I have worked on. It's for the most part going to be something only used on my website, but as I'm designing it, I'm keeping customization in mind.

All of the various CMSs that I have tried in the past don't have the capabilities I am looking for. Sure you can write your own modules and blocks, but instead of learning how to code for someone else's software, I'd rather create my own framework and build from that.

The part I have to work on now is making the site much more efficient to the average user (IE faster page generation times, fewer queries, etc). Anyone have any tips for testing sites under load? IE any software out there to emulate 100s of viewers looking at the site at the same time?

Re:Developing My Own (1)

FunkyELF (609131) | about 6 years ago | (#25388379)

As far as the initial product I'd say I'm 80% or so done.

If you install django and run " startproject cms" you'd be 80% done too.

The part I have to work on now is making the site much more efficient to the average user (IE faster page generation times, fewer queries, etc). Anyone have any tips for testing sites under load? IE any software out there to emulate 100s of viewers looking at the site at the same time?

If you used a framework rather than PHP directly you wouldn't have to worry about stuff like that... other smart people (not that you're not) do that for you.

Re:Developing My Own (1)

Teilo (91279) | about 6 years ago | (#25388755)

If you install django and run " startproject cms" you'd be 80% done too.

Yeah, if you wanted everybody to edit their templates from the filesystem, didn't care about most CMS niceties like a menu system integrated with a hierarchical page structure, expected people to edit regex tuples to configure URLs - in short if all you cared about was a way to do quick-and-dirty page templating with barebones authentication - then yeah, you would be 80% done.

Django makes building a CMS much easier, probably easier than any framework in existence. But be realistic. It's quite easy to patch a bunch of stand-alone apps together, but to integrate them well with one another in something that does not bear a resemblance to Frankenstein's monster? No.

Re:Developing My Own (1)

truthsearch (249536) | about 6 years ago | (#25388659)

The part I have to work on now is making the site much more efficient to the average user (IE faster page generation times, fewer queries, etc)

Here's some performance tips for a starting point [] . Assuming no major database bottlenecks, be sure to look outside your code for quicker page rendering, starting with gzip compression and tweaking KeepAlive [] .

As for real load testing the only useful services I've found cost serious money.

Re:Developing My Own (1)

burnin1965 (535071) | about 6 years ago | (#25389607)

I used siege [] to run load tests [] on a server with the MVCbench [] PHP test framework.

Re:Developing My Own (2, Interesting)

Delifisek (190943) | about 6 years ago | (#25389795)

Well. Performance is very easy thing under php, if you know what you doing.

Change your mind to use opcode cache advantage in every where.

For example, neary every php example uses the sql and the others uses XML for data storage...

If you do not need to use Sql search facilites, you should have to save your data in php array format.

With APC or similar opcode cache or with PHP6 you got all your data in the server memory. No need to sql connection, no need to xml parsing. Just opcode cache.

Also using spagetti code in templates are another way to speed up php code.

And if your site is big you can easly move to memcached.

Why? (1)

florewacks (692194) | about 6 years ago | (#25388021)

I might be reinventing the wheel of this argument, but just to make sure it's articulated: Do we really need to encourage more programmers to reinvent the wheel on the CMS? I feel like that approach should be discouraged for the sake of all of the non-technical users out there who have to deal with engineer-built back-end interfaces that tend to result from projects like what one would use this book to approach.

Even major, enterprise-level CMS solutions would probably benefit from starting with an off-the-shelf solution that has a back-end with a few years of solid UI refinement behind it and extending that with whatever functionality is required, though an API or otherwise.

The perfect CMS may not have been invented yet, but programmers need to realize that they're not going to make a better one from scratch. They're just going to make another mediochre entry for the left column of CMS Matrix [] . Why not choose one of the dominant options out there, join it's development community, and start working to make it solve your problems?

I haven't read this book and it may well provide a good overview of the basic architectural questions one would want to be familiar with to approach an existing system. And I'm certainly not saying it should be published. But a book like this should, I feel, at least start with a discussion of _why_ you would want to build a CMS from scratch, before it gets into how.

I agree 100 percent! (1)

purpleraison (1042004) | about 6 years ago | (#25388475)

Admittedly people may decide to make their own as a challenge, but there is just as much to be gained knowledge-wise working with on devs on an existing project that are similar to your needs.

Heck, it is even more logical to take an existing CMS and tailor it to suit your needs.

Not to plug names, but Xaraya, Zikula (formerly Postnuke), and even Xoops are fun to play with.

However, nothing really matches the learning experience of trying to build one from the ground up. But it's best to skip that step and play with a 'working model' so to speak.

Re:Why? (0)

Anonymous Coward | about 6 years ago | (#25388523)

"Do we really need to encourage more programmers to reinvent the wheel on the CMS?"

Yes because virtually ever CMS out there is based on spaghetti code, like a great sprawling construction built on top of a shitty foundation.

Yes some of the towers will be pretty, but in the end the foundation is still flawed and a flawed foundation will always come back and bite you in your ass. I have yet to find a cms that even remotely conforms to the methodology of framework as I perceive it.

"but programmers need to realize that they're not going to make a better one from scratch"

are you sure? I know for a fact that I can, and that there are many others also with the same ability. It just takes time, time which I would prefer to spend making something from scratch than contributing to a irremediable codebase, governed by a pack of assholes bent on furthering their own financial / power mongering aspirations (ie Joomla, OSM and most of the others I have seen).

Interesting. Maybe. (1)

dedazo (737510) | about 6 years ago | (#25388033)

At first I thought wow, a book to write CMSs in PHP, that's a fresh idea. Admittedly PHP has been used to write a great majority of content management systems in use today. More so if you include things like forums in the category. It seems like every developer's first non-trivial PHP project is a CMS of some sort.

But if this book is good enough to formalize the various basic elements of a content management system and present ways to implement them effectively (read: best practices) then I suppose it could be considered valuable. I hope it includes a really big chapter on how to properly use your RDBMS to avoid SQL injection vulnerabilities.

Still, I think a lot of detail is missing from the review. For example, the mention of chapter 5 on how to organize data is not very detailed. Does the author discuss entity models, for example? And when to use them or avoid them? On security, are non-permissive grant matrices discussed? Or alternatives to them? And how they can tie into an entity model, if you're using one? What about more esoteric identity management, like single sign-on systems? Authentication and authorization techniques? What about environment configuration? Deployment?

I think that for a write up that's supposed to be consumed by developers, the reviewer omitted some crucial information that would help me decide whether or not the book is worth buying. The fact that the book is authored by "the guy that wrote the XYZ CMS" doesn't necessarily carry much weight, in my opinion.

Onpub (1)

chmt (1386507) | about 6 years ago | (#25388069)

A CMS framework is not something easy to build. It's hard to strike a balance between what features to make available and what to hold back for simplicity's sake. This is something I've been trying to accomplish for several years now. I think I've come up with something pretty simple and reliable, but it still needs work and some extra bells and whistles. I'm looking for folks to help out with development of my CMS API/Framework, OnpubAPI. If you're interested check out the website [] for more info about the software. I figured I'd post something in the context of this article with the hopes that other folks who are interested in CMS frameworks and/or APIs will see this and be willing to send feedback and maybe even code. --Corey

What's the point of this book, really? (1)

MikeRT (947531) | about 6 years ago | (#25388131)

If you know PHP, shouldn't you be able to extend WordPress or one of the other CMSes written in PHP? I would imagine that in practice, this book would be about as useful as "Java7 GUI Framework Development" (because Swing, AWT, SWT and Qt are not enough choices!)

Instead of rolling your own, why not work on one that's already established that you like? Just because you can write your own, doesn't mean that your results won't be a lot better and more interesting if you start working on existing code.

Re:What's the point of this book, really? (1)

v3xt0r (799856) | about 6 years ago | (#25389237)

There are many reasons to chose to create your own framework, just as there are many reasons why you may choose not to.

Personally, I avoid mainstream OSS frameworks because of the security implications involved. Not that writing your own framework will reduce security implications (technically), but if you look at wordpress or joomla, both of which had a number of security exploits that targeted and penetrated millions of web sites that were using them, begs the question: would you want to be another one of those 'stunned' victims?

There are 'robots' crawling the web specifically programmed to root-out targeted exploits within specific OSS web apps, such as wordpress and joomla. The chances of someone writing a bot to exploit your (1 and only) framework, that nobody else uses, is a LOT less likely, albeit still possible.

There are also code-control issues to consider. As someone who has written PHP for years, and had to work with other people's code as well, I find it far less aggravating to work with my own code base, especially considering it takes about as long to adapt to someone else's code, as it does to simply write your own.

Originality is another big issue as well. If I have to look at one more mucked-up wordpress, drupal, or joomla site again, I think I'll stop browsing the internet entirely. Blogs have ruined the Web Application Ecosystem, imho. /digress

Meh (0)

Anonymous Coward | about 6 years ago | (#25388209)

Let's see. 348 pages at almost $50 USD. Add previously mentioned factor of reinventing the wheel. Add previously mentioned factor of building "an Aliro" by the time you finish the book when you could have just downloaded it instead. Add the fact that there are several high profile CMS projects which are free to download, and having only a mild learning curve. Also as mentioned by another, I've not heard of this Aliro until this article. I'll be frank, I have zero need for such a book, but if I did, I'd owe it to myself to guage the author's talents by scrutinizing the Aliro codebase first. But again, I'd probably just download that instead.

So are plants the new drawn animals (1)

Deag (250823) | about 6 years ago | (#25388437)

... when it comes to programming book covers?

Re:So are plants the new drawn animals (0)

Anonymous Coward | about 6 years ago | (#25390267)

Yes [] .

Best CMS packages? (0)

Anonymous Coward | about 6 years ago | (#25388625)

Lets turn this into something usefull. What are the best open-source CMS packages?

Re:Best CMS packages? (4, Insightful)

scorp1us (235526) | about 6 years ago | (#25389405)

Drupal (PHP)
Zope/Plone (Python)

Re:Best CMS packages? (0)

Anonymous Coward | about 6 years ago | (#25396341)

What about eZ Publish?

Re:Best CMS packages? (0)

Anonymous Coward | about 6 years ago | (#25396971)

I tried Drupal and cant honestly call it a CMS. A "blog management system" suits better.

On another note, since i discovered the TypoLight CMS i intend to use it as a framework for my applications. Its well designed, well documented under the hood.

Re:Best CMS packages? (1)

Auxbuss (973326) | about 6 years ago | (#25405307)

Why Drupal? I know that it's everyone's love child, and I'd like to use it, but the deployment issue is a showstopper. How do I develop with it local, across multiple development machines within the team, say, via svn, promote to staging, then deploy? What have I missed?

Re:Best CMS packages? (1)

scorp1us (235526) | about 6 years ago | (#25412807)

I don't understand your question. Are you talking from a module-centric (code) way, or a content-centric way?

The module centric stuff should be easy to do. You have a mainline which is staging, and a release branch for deployment. Your developers develop in their own branch and integrate to main. If you want a QA cycle, then that's branched to from main, then integrated back to main.

The only problem is the database... you'd need a partial replication. You need to take the production database and have that feed into your staging and development without having staging or development feed into production...

Re:Best CMS packages? (1)

Auxbuss (973326) | about 6 years ago | (#25429547)

Module or code -centric, doesn't matter.

Developers develop, submit to staging, the work is tested and then deployed to live.

As you say, the problem is the database. You do indeed need "partial replication".

And that's the issue, how do you do this?

Just seems to me that the Drupal developers didn't take this into account, and it's a showstopper for multi-developer environments, especially where - with continuous integration tools - we are used to this kind of things being automated and thus requiring almost zero effort (once set up).

Re:Best CMS packages? (1)

akbarr (1388795) | about 6 years ago | (#25425467) []

Depends. This is the top list. (1)

Qbertino (265505) | about 6 years ago | (#25390549)

Plone - Technologically Plone is the leading CMS as it's built on top of Zope, a Web Application Server with an integrated Object-Relational DB. Zope basically is what all other web frameworks want to be when they grow up. Rails including. It is considered by many CMS dev-teams to be the holy grail, and most other CMS crews, such as Joomla, Typo3 or Rails usually speak very favourably of it. However the downside of its conceptual superiority can be - of course - performance. Since it takes aprox. 5 minutes to load balance a single instance across 2 or more servers, this isn't that much of a problem and many professional CMS enviroments who have the resources to build their stack around Python (Plone & Zopes PL) and Zope use it. Zope also is the oldest and most mature of modern paradigm systems, dating back to 1999.

EZ Publish - EZ Publish is a widespread mature PHP CMS, with a compareatively large international second market that has grown around it. The main developer is a norwegian company that provides consulting and services for EZ Publish and sees to it that it maintains its overall professional feel.

Typo3 - Typo3 is an Enterprise CMS Behemoth built with PHP. It's a massive piece of software that comes with the most comprehensive set of features in the web CMS field. It has a very large second market with many high profile agencies and system houses offering programming and services. OReilly even has a thick animal book on TypoScript, the Typo3 Configuration language, which sort of goes to show its impact. Typo3 also pratically owns the german speaking market. You can actually make a living as a Typo3 programmer in Central Europe. The next major release due within the next year or two is in the works and is a complete redo of the entire Typo3 stack including a FW called Flow3 that attempts to integrate the purest of modern architectures. As far as that is possible with a classic seperate SQL-driven RDBMS.

Joomla! - Joomla! is a PHP Web-CMS and one of the most popular pieces of software in general. (A Google query usually scores somewhere around a hundred million hits). Installation and operation is insanely easy and it has an impressive featureset. It only has a handfull of user types and lacks flexible granular n-dimensional user right management however - the most prominent missing feature. It makes up for this in ease of use and maturity of the admin interface and the integrated templates. It usually takes less than 10 minutes to set up a ready Joomla site.

As a regular php dev (2, Insightful)

Vamman (1156411) | about 6 years ago | (#25388883)

Since I receive many contracts from clients wanting web work done I'm prone to suggesting the use of Joomla or some other OpenSource project because I know that these projects will work for most applications and employers don't want to spend $5000 for a custom application, they want to spend $500 for a custom template. However, recently I've been working on several larger sites and have been dealing with these 'hacker' groups on a daily basis and I find the security vulnerabilities being exploited in not only Open CMS systems but also bulletin boards (that you have to buy) and so on. So I've gone back coding from scratch because it is truly the only way to secure a good system in PHP. Custom variables =)

That's exactly what we need! (1)

Yeorwned (1233604) | about 6 years ago | (#25389511)

There obviously arn't enough halfass php cms frameworks out there so why not buy a book and contribute to soceity!

A custom CMS is only worth it... (1)

moore.dustin (942289) | about 6 years ago | (#25389545)

A custom CMS is only worth it if you are looking to improve upon what is currently out there. Most of the options out there are pretty awful and hacking them up is a job for the more novice coders. If you do not poses the skills to know what is wrong with a CMS, _why_ it is wrong and how to fix it, then you have no business creating your own CMS. If you want to tackle a project like this, you need to have the dedication to do it right. I wont go into what exactly 'doing it right' is as it differs from person to person, but needless to say it can be simply stated as _thoroughness_.

Speaking from first hand experience, my CMS was an idea on paper for a while before any code was written. If you cannot answer and account for _every_ detail and circumstance on paper, I do not suggest undertaking something like this.

Re:A custom CMS is only worth it... (1)

truthsearch (249536) | about 6 years ago | (#25390265)

If you cannot answer and account for _every_ detail and circumstance on paper, I do not suggest undertaking something like this.

Actually, if everyone did that for every software project we'd all be a lot better off. Code quality would probably be much higher and maintenance time lower.

Re:A custom CMS is only worth it... (0)

Anonymous Coward | about 6 years ago | (#25393969)

If you cannot answer and account for _every_ detail and circumstance on paper, I do not suggest undertaking something like this.

Actually, if everyone did that for every software project we'd all be a lot better off. Code quality would probably be much higher and maintenance time lower.

That sounds pretty waterfall. Unfortunately, we live in an agile world.

Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?