Archives

Articles tagged ‘templates’

The Layout Concept

Sites with loads of pages can be hard to manage. Includes were the gold pot in the end of the rainbow times ago so people could put repeated content (like headers, footers and menus) under a single file and thus including into the page/template.

But have you ever wondered that you keep having the same include occurrences at the pages? The layout concept (that I first saw under CakePHP [but it may have come from Rails actually]) brings you more flexibility and DRYness on working with templates.
Read the full article

Understanding the MVC pattern

In my quest for the perfect code I’ve ran thru many tries since I’ve entered the OOP writing utility classes and even coded my own templating system with a simple wildcard replacing variable system but it lacked intowflow controlw structures.

Then I’ve had contact with Smarty and PEAR’s DataObject (PHP language) at a company I’ve worked last year when we used a (very primitive and simple) kind of MVC with DO as model layer, Smarty as view layer and only one huge (around 130 KSLOC) controller that we called “The Godfather” as a private joke. After all, besides DO’s memory meanace, (almost) everything worked as it should but only after I’ve worked with CakePHP’s (Ruby’s) MVC implemetation that I realised how everything should behave.

MVC stands for “Model View Controller” and it’s a multi-layered design pattern. It’s one of the most famous (uhhh the flashes!) and organized design patterns I’ve worked so far because you can split the codes from your database calls and templating system.
Read the full article