Seperating code from content?

Many people have talked about seperating style from content (2, 3, 4), but for those of us who also code, what about seperating code from content? At present I’m in the process of coding a backend for a new site, but because I’m only at the intermediate stage of my PHP learning curve I’m still finding it difficult to learn how to best implement this.

Should I employ some sort of templating engine or maybe get creative with php classes?

If you know of any blog entries or articles or if you have any advice, please do post a comment. Thanks :)