Advertisement

Posts Tagged ‘template’

11|17

Simple Templates: Easy as Pie

The Problem

I’m working on a project and have to generate the same template on 4 different pages. I was also using javascript to create the same template on the fly. Needless to say this wasn’t the most efficient way of doing things because if I needed to change 1 aspect of the template, I needed to edit 4 different files.

I tried to write a little function, inspired by CakePHP, that would take an array of information, open up a template, replace any text and then return the new content. Continue reading