SitePoint Sponsor

User Tag List

View Poll Results: Should OOP be used with Content Management Systems?

Voters
32. You may not vote on this poll
  • Yes - Completely

    23 71.88%
  • Just where it would make sense

    8 25.00%
  • No

    1 3.13%
Results 1 to 19 of 19
  1. #1
    SitePoint Member
    Join Date
    Mar 2003
    Location
    ny
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Content Management System/OOP

    This topic may have been beaten to death, but I will open it anyway. I've worked with PHP Nuke and Geeklog, and for simple Web sites with some articles and forums, these will do fine. But for larger, more powerful Web sites, you really have to hack these CMSes to get the functionality you need. I think that most of you would agree that hacking is not the way to go. The code is not consistent, and if you find errors it is a pain to find the source of the problems. Most of the time you have to alter the database structure to incorporate new functionality. Another issue I have with PHP Nuke and similar CMSes is that they all look the same. You have to fit your design to theirs, not the other way around. If you want to incorporate your own design, then you have to hack your way around it. Usually you have a set of links at the top, content down the middle, and links, polls and calendars down the left and right sides. You know when you've hit a PHP Nuke Web site. There has to be a more elegant solution.

    I've done some research and found that there is some buzz surrounding CMSes like EZ Publish and Mambo Server. Unfortunately, EZ Publish seems to be a pain to install and configure. Mambo doesn't look a whole lot different from other CMSes. Most of these CMSes have some sort of modular-based system where you can extend the functionality by writing your own modules. This is quite important because no CMS seems to contain all of the necessary functionality and work "right out of the box." That is to be expected.

    When you work on projects, you will most likely not write something from scratch. You have a host of CMSes out there to choose from. Do you know of any other good articles like the EZ Publish article here on Sitepoint that give you a better idea of what to expect from these CMSes? Has anyone worked on a large project with one of these free CMSes and had very little problem incorporating new functionality.

    I was brought in midway to a PHP Nuke Web site that was hacked to incorporate a totally separate forum application and gallery application. It is an ugly project. I thought that PHP Nuke provided this type of functionality, but the programmer opted to use two other separate applications. Would you not agree that this sort of hack will eventually cause more headaches than it is worth? I've already had to deal with combining the user databases for all three applications and it really sucks. You have to change alot of the code, and soon the application starts to break down. They should have started with a better, more integrated CMS. I wonder if anyone could point me to a solid CMS that I don't have to hack to get the most functionality - use of modules, classes, templates, etc?

    I'd rather use a CMS with fewer bells and whistles and more stability and extendability. The extendability should be standardized and easy to understand. I've read about the Fusebox approach as well as the OOP approach to application design. Both seem to have their merits. It seems like most CMSes out there use OOP to some degree, but not to the point where you can get the most out of classes. Granted PHP is not a true OOP language and there might or might not be some resource issues, but there must better way to write these programs. They seem to be written by multiple programmers with different approaches. Is too much OOP with PHP more of a hassle than it's worth?

    I am not an expert programmer by any stretch of the imagination, but I wonder if there is anyone else out there who feels the same way about CMSes.

    As a side note, if you haven't already checked out PHPCollab, you should do so. This is one PHP application that has really impressed me. The application is very stable and functional, yet it does not try to overwhelm you with unneeded functionality. It is based on Macromedia's defunct Sitespring application. It is a project management application.

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CMS I am working on for some of my clients is 99.99% OO. The base of it is a framework to handle parsing of XML, XSL, Content caching, code profiling (for debug), configuration management and a few other bits, it's 100% OO and extensible, to extend it, all you have to do is create a new class, add it to the array of modules and then call the load method which checks if a module is installed, enabled and licensed for use. The CMS which is built on top of it is 99.9% OO and extensible in a similar way, you write the content type module, add a row to the content types table and create a new table for the content type (which basically extends a generic content type table) and you're all set. The base class of the CMS extends the main class of the framework and runs all calls to objects via a generic call() method - which checks if the object is loaded and if the method exists.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Zealot ZangBunny's Avatar
    Join Date
    Jul 2003
    Location
    Mainz, Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We have started a CMS project from scratch, because most other projects seem to be hampered by the mostly procedural codebase that they inherit from their *nuke roots. By starting from scratch, sticking to well tested design patterns (Martin Fowler's new book is invaluable in this), and trying to do test-driven development using SimpleTest, we hope to arrive at a system that is more flexible and more easily extensible than current CMSs, delivering a comprehensive and well documented API for module developers.

    We are using an MVC design, not unlike Phrame but custom built to fit our needs. Separation of business- from presentation logic is done with an enhanced AwsomeTemplateEngine with the option of switching to SimpleTemplate.

    However, we are willing to sacrifice the purity of OOP for performance and ease of use. Instead of building on a full OO framework like Vincent's excellent Eclipse, we decided to stick closer to "traditional" PHP coding in some places. For example, we use "foreach" instead of iterators.

    I can't say much more at the moment, because our prototype core is changing very quickly, so I'd be shooting at a moving target. You'll hear more when we get the first alpha version out ;-)

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not bad though IMO you'd be far better off in the long term development and growth of your CMS if your using primarly OO to use Iterators;

    Simply because this offer's more options for you to build from in the future over what you can do with foreach().

    But that's just my way of thinking though

    Off Topic:

    Everyone is saying how great Martin Fowlers book on design patterns is - is it that great really ? Looks like I'll have to nip over to Amazon to see what they've got on offer at the moment huh ?

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Xml/xslt

    [QUOTE]CMS I am working on for some of my clients is 99.99% OO. The base of it is a framework to handle parsing of XML, XSL, Content caching, code profiling (for debug), configuration management and a few other bits, it's 100% OO and extensible, to extend it, all you have to do is create a new class, add it to the array of modules and then call the load method which checks if a module is installed, enabled and licensed for use. The CMS which is built on top of it is 99.9% OO and extensible in a similar way, you write the content type module, add a row to the content types table and create a new table for the content type (which basically extends a generic content type table) and you're all set. The base class of the CMS extends the main class of the framework and runs all calls to objects via a generic call() method - which checks if the object is loaded and if the method exists. [\QUOTE]

    regarding your current project, I'm currently doing exacting the same sort f thing in PHP5, alhough i'm just wondering, how you implemented iterators or output the XML from the DB to be processed by sablotron? I have previously done this before, however I do not beleive it was a truly flexible method, anyway I would appreciate any feed back on this.

  6. #6
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the moment, all functions that return DB output return a PEAR:B result object which are then usually itterated through in a while loop. The content is then formed into XML and passed to one of:

    DOM XSL
    Sablotron
    or libxslt (For PHP5)

    Depending on the config option selected by the user.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  7. #7
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm.... Used Sablotron before and I like how it works although how do you use libxslt ?

    I assume now that it is pre-built with PHP5 you'd have a number of classes available to use... PEAR maybe ?

  8. #8
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I try and use PEAR as little as possible to be honest, the only thing I use it for is PEAR:B. I wrote my own set of XSLT classes:

    Base Class
    DOM XML Class
    Sablotron Class
    libxslt Class for PHP5

    libxslt is pretty easy to use once you find some docs for it, no unexpected hiccups etc. but then again libxslt is exaclty what is used in the DOM XSL extension.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  9. #9
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Palo Alto
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Karl
    I try and use PEAR as little as possible to be honest
    I'll second that. I'd use Eclipse or roll my own instead, just too much overhead in PEAR. I've heard there will be a lot of rewriting done for PEAR in PHP5 though, so I'll keep my eyes (and options) open.

  10. #10
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm... PEAR is getting better though it still isn't all there yet ?

    Karl - I wrote my own classes as well though can you recommend any documentation on libxslt and PHP5 ?

    Thanks

  11. #11
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I'm looking at doing my own DB abstraction or using Eclipse, just that for the sake of getting it working and developing with DB in place it was easier to use PEAR:B which I am familiar with.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  12. #12
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It took me absolutely ages to find evena sniff of the docs on libxsl and PHP5, I'll see if I still have the URL in my history as I stupidly didn't bookmark it.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  13. #13
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks...

  14. #14
    SitePoint Enthusiast acostin's Avatar
    Join Date
    Mar 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Komplete Lite CMS

    Hello,

    We (www.interakt.ro) also support a very powerful, open and innovative CMS based on our Krysalis platform: http://www.interakt.ro/products/KompleteLite/index.php

    But first of all, let me present an overview of Krysalis and of the other powerful tools that you can use from InterAKT Krysalis - it's a platform (inspired from Cocoon2) to allow content publishing using XML as the data representation mode and XSL to add the presentation layer on it. It also includes a MVC (Model View Controller) implementation to allow you to fit how web requests are served from your site. Krysalis includes some features for authentication, validation and dynamic XML generation, and also includes a lot of (what our marketing department likes to call) "enterprise level" code techniques - that is taglib code reuse (in the application logic and presentation layer), etc.

    Another interesting feature integrated in the Krysalis core is the caching mechanism. Being a pretty abstract architecture where flexibility is a must and everything is defined using XML, we needed a very powerful way to transform those XML definitions into pure executable PHP code. We have started with PEAR cache but it was not up to the task, so we've come with our own cache implementation, that keeps the generated PHP code on the disk in a require (this way the generated file can be also compiled when using a PHP Accelerator).

    This is what we've done for caching the generated code.

    We have discovered also that a page request on a complex site (because of the SQL queries) could take 150-1000 millis. This is not acceptable for us, so we've added in the controller a Cacher component, that can be associated with a timeout to any pipeline (a definition of how a request is served).

    So for the output, we have this mechanism of defining caching rules (you can define for each page the session/get/cookie variables that decide if the page is cached or not) and for each unique group of identifiers, the output is stored on the disk - and when a new request is made with the same variables, the cached output is served (in around 25-35 milliseconds).

    The most interesting thing is that we've started optimizing just weeks ago (after we've returned from the Amsterdam PHP Conference where we've presented Krysalis to Sterling Huges - one of the main PHP developers and he gave us some hints about performance and targets for it - 150 req/sec). So we know there is still room for improvement in the engine.

    What we also have in Krysalis is the possibility to aggregate parts of the site - for example in a regular site we have the menu, the content and the nuggets. We can define each of those page sections in separate pipelines, and aggregate them at runtime. Considering that each of those sections usually can be kept cached for a different period of time (the nuggets will have the smaller cache time, then the content then the menu), we will be able to define in the sitemap rules to keep each of the content cached and regenerate only the required part once per minute for nuggets, once at 30 minutes for content and once a day for the menu). This way, even cache missed are only partial misses as the page is not completely regenerated - however those cases are pretty rare.
    Anyway, the most interesting part is that we have an already open CMS built upon Krysalis - the Komplete Lite CMS (I am proposing the lite for now as it's open source - but we can go and check the full version later on). Komplete Lite was designed for Krysalis and I can also say that Krysalis advanced because of Komplete requirements.

    We have tried to make Komplete a very adaptive CMS, that allows us to use most of the nice Krysalis features - I think all of them:
    - it uses taglibs everywhere for code reuse
    - it's pages are designed as aggregated pipelines with cache support for performance and for site section independence
    - it is based completely on the separation of application logic from the presentation layer - so changing the presentation layer can be made with a simple click
    - it already includes a very powerful structure manager
    - has various page types (to be rendered in the central site section) and can easily include new page types
    - it can import RSS streams from other sites
    - has support for various types of nuggets (not as many as nuke, but we are welcoming contributions)
    - includes a visual HTML editor (KTML lite)
    - and many other features.
    Komplete Lite can be found at http://www.interakt.ro/products/KompleteLite/index.php

    I think the product worth a close look(we are still working at the 1.0 final release with documentation as we speak) - but it's a very good start to help you create a real portal.

    Alexandru
    Last edited by acostin; Aug 11, 2003 at 13:56.

  15. #15
    SitePoint Enthusiast acostin's Avatar
    Join Date
    Mar 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    As for OOP portals, I have declare I am against PHP and Objects and dynamic websites. By nature, you will want to model objects in an application to combine data with the application logic in the same place. This means that you have a persistent way of storing information, and the methods to manipulate it.

    Also by nature, web pages always instantiate all the objects, and call some methods to load all the information from the database, and then call the methods to process the info and generate some output.

    This is not very clever, as you don't really benefit from the OOP approach more than it helps you structure your code better. Moreover, people started creating objects that output the design section inside some obscure methods (see postNuke for example) - having the design tightly embedded in the code - and this is pretty scary and makes a site update a very messy task.

    I think that whatever the future will be, this mix of having the objects output their design directly from the code will never allow you to create powerful, skinnable web applications with a minimum effort.

    Our approach to separate the application logic from the presentation layer, using XML as the transport data structure, and XSL to add the presentation layer, also using a controller, seem much more appropriate when it comes to code reuse, multiple presentations for the same data, etc.

    We use classes in Krysalis to do some reuse - but mostly this is for code structuring. As for the XML support, we have choosed domxml/domxsl and have renounced at Sablotron (too slow and potentially unsupported in future version of PHP)

    However, out approach also has the flaw of being hard to learn - and we are also very limited in resources concerning the documentation.

    So it might take a little while until we will release a really extensible version of Komplete Lite.

    Alexandru
    Last edited by acostin; Aug 11, 2003 at 13:58.

  16. #16
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Acostin - Normally a post like yours would be borderline advertising but seen as it's packed with technical info I'd guess you're fine.

    I have to agree on some of the so called "CMS" systems out there and their OOP implementation, I'm certainly no fan of nuke. As you say, HTML in the PHP is not extensible at all. Personally I take the same approach as you guys, XML as a transport, XSL as a display layer.

    Again, agreed on Sablotron, I found a 40-50% speed increase in using DOM XML/XSL for the same job, which is nothing to be sniffed at, but chose to provide modules for both as it gives great flexability to any potential user.

    Sounds like you've got a great product and a good set of developers, I wish you luck. Me, well I'm an stalwart of DIY, even though there is just me developing my framework and CMS.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  17. #17
    SitePoint Enthusiast acostin's Avatar
    Join Date
    Mar 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Acostin - Normally a post like yours would be borderline advertising but seen as it's packed with technical info I'd guess you're fine.
    I really try to be fine - after all, Komplete Lite is an open source platform, and even if we use it to promote the name of the company, this is the only benefit we get from it (no money involved)

    I have to agree on some of the so called "CMS" systems out there and their OOP implementation, I'm certainly no fan of nuke. As you say, HTML in the PHP is not extensible at all. Personally I take the same approach as you guys, XML as a transport, XSL as a display layer.
    I'm glad we have reached the same solution to this problem. We have initially inspired from Cocoon2, but we have introduced a lot of innovation in the platform. Maybe you will consider Krysalis as the platform for your CMS - we have a completely open solution that you can use for start, and we also provide help in your endeavor.

    Again, agreed on Sablotron, I found a 40-50% speed increase in using DOM XML/XSL for the same job, which is nothing to be sniffed at, but chose to provide modules for both as it gives great flexability to any potential user.
    We have initially supported both, but unfortunately the speed difference was too high so we've finally abandoned Sablotron (and also PHP5 will have support only for DOMXML).

    Sounds like you've got a great product and a good set of developers, I wish you luck. Me, well I'm an stalwart of DIY, even though there is just me developing my framework and CMS.
    You can stay DIY - but just using our framework below your CMS. You will find a lot of interesting features inside, I am sure.

    Alexandru

  18. #18
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by acostin
    We have initially supported both, but unfortunately the speed difference was too high so we've finally abandoned Sablotron (and also PHP5 will have support only for DOMXML).
    I presume that development in PHP5 is already underway? Is there any key aspects or new editions to PHP, which Krysalis will focus on in the new edition?

  19. #19
    SitePoint Enthusiast acostin's Avatar
    Join Date
    Mar 2002
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We have started to investigate the DOMXML/XSL support in PHP5, and we'll release a version supporting PHP 5 in several month.

    We plan to release Krysalis 2.5 with PHP5 support sometimes this fall. We will try to integrate the new domxml engine, and we'll also consider changing the Krysalis error handling with try/catch constructs.

    All other improvements in PHP5 will be included as necessary.

    Alexandru


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •