View Single Post
  #8 (permalink)  
Old 09-01-2008, 12:25 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,569
Last Blog:
Tidy up your HTML
Credits: 0
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: Creating template system for my own cms

Quote:
Originally Posted by orjan View Post
Well, how would a template engine work otherwise, if not being a mid-layer in between the produced data and the finished html?

in this way, you can, with the same code, in an very easy way, make totally different layouts with the same data, even for two users at the same time.

maybe there are better template engines, That I can't tell, but I've found the smarty engine to work well for me, then I can create my coding, and then a designer can work with the tpl-files how they like without disturbing the code at all, just inserting variables (and a few control parameters) into their design-html-code.

maybe you have some good suggestions of how to create layout templates in other ways?
You have described is the exact reason behind the MVC structure. I believe a template should be a separate layer of abstraction almost completely decoupled from the MVC itself. That said, I place my "template" in then front controller. The front controller then loads the individual page controllers (and thus the associated models and views).

I have never used it, but phpSavant does not compile the template which makes a whole lot more sense to me.
Reply With Quote