jacksonh.tumblr.com

0 notes &

How much code is too much code in a web template?

I need your help here.

I’ve been working on my web template engine and I can’t decide exactly what sort of things should be allowed in templates. I think most people agree that these things should be available:

  1. Property Access
  2. if/else/else if Branching
  3. Iteration over loops
  4. Formatting
  5. Math operations (think if (foo > 10 + bar))

It gets a little foggier here:

  1. Method Invocation
  2. Variable Declaration
  3. Variable Setting
  4. Method Declaration

After that its pretty much full on double rainbow access to the underlying language.

{{ 
     if (count > foobar ()) {
         Response.Write ("foo");
     }
}}

I think most people agree that there should be a line drawn and code should be kept out of the templates, but where do you feel the template engine should draw the line?