I just thought I would drop this little tidbit to help save someone some time (hopefully). In the smarty template engine there is a pretty useful call “register_prefilter” which basically lets you pass a function to smarty that gets run on the whole template file before the template file itself has any of the substitutions made to it. This can be a god-send, however the first time you use it it probably won’t seem like it’s working. The secret is that you need to go into your templates_c directory, and dump all of the compiled templates every time you change the pre-filter.