Home » PHP » PHP MVC Frameworks » Codeigniter Template Layouts

Codeigniter Template Layouts

All I have to say is WOW… I decided to give CodeIgniter a try as it’s a pretty light weight library and doesn’t try to force you into using ActiveRecord, but guess what?  There isn’t a built-in template layout concept so you can add a consistent header and footer and that’s like the most common thing anyone will do with a website.

For someone new to CodeIgniter, that’s just bullshit. What’s even more annoying is that there are a few different solutions to this problem offered by people but there isn’t really a standard one and you’d think that by version 1.7.2 someone would come up with one to put in the core.  I know understand how Kohana came about.  Also, what’s quite annoying is that there isn’t really a contributions directory with ratings, etc, like there is for many other open source projects like Yii, jQuery, Drupal and so on.

Building a strong community with all the community support features around the project is extremely important and I don’t think CI have done that great a job, given this little experience.

  • Share/Bookmark
Categories: PHP MVC Frameworks Tags:
  1. Bob
    June 6th, 2010 at 22:15 | #1

    Wow is right – how can you miss this hugely popular site?

    http://codeigniterdirectory.com/

    The beauty of CI is that it doesn’t force you to do anything. There are many templating systems available, why do you think one standard needs to exist?

    Seems you didn’t do much research…

  2. June 7th, 2010 at 13:42 | #2

    Thanks, indeed I didn’t know about codeigniterdirectory which seems like a pretty good resource, however I am still very much of the opinion that a good framework should provide stuff like templating out of the box and that’s something that framework designers should have thought about. For example, ASP.NET MVC, Zend Framework, Yii Framework and Kohana PHP have all thought about and solved this common problem. As someone who wants to use a framework to save time and not have to re-invent the wheel I shouldn’t need to go searching for 3rd party contribution to do something as common as templating. I would expect that from some new framework that’s still in alpha, not a mature framework that many consider one of the best PHP frameworks around like CodeIgniter!

  3. Geoff M
    August 29th, 2010 at 11:32 | #3

    Did you know there’s a highly performant templating engine already in PHP (and by extension, Codeigniter) ? It’s called (drum roll…) PHP. OK, if you think is too hard for designers to write, then fair enough – plug in a templating engine of your choice. Nothing in PHP prevents a separation of concerns or inversion of control (and CI even enables it), which are the issues usually cited for creating a special TE in the first place. Remember, when originally designing PHP Rasmuss created an embedded hypertext (template) language – PHP – which was originally processed by a Perl script. Seems ironic to need to write another templating language with a templating language, but you can hardly blame CI for ignoring the non-problem.

    For simple to medium cases PHP is fine, for complex cases, have the programmers pipeline their business logic stage that produces XML going into an XSLT view renderer producing XHTML that has been abstracted from a designer’s mockup. Libraries like libxslt are optimised for template rendering speed, unlike PHP when it is unnecessarily performing a template engine within a template engine function.

  4. August 29th, 2010 at 13:19 | #4

    OK, it seems like another fella you’ve missed the point of my post. When I talk about Template Layouts I’m not talking about a templating engine like Smarty. I completely agree that something like Smarty isn’t worth doing when you have PHP. The only time something like that would be worth doing is when you want users to be able to create and upload their own templates and you dont’ want to give them the power of using PHP (as they can cause some serious damage that way).

    The template layouts that I’m talking about is having a common header and footer and number of columns… So basically the same thing as a MasterPage in ASP.NET or a layout in Yii. Sure you could probably do an include on every page or use of the the many options available in for doign template layouts, but the point is that something like that should be built into the framework as its probably the most common thing you need to do if your site has any more than 3 pages.

  1. No trackbacks yet.