From: Andreas Schwarz Date: 2004-03-08T21:39:39+09:00 Subject: Re: Looking for HTML templating system Ruby Baby wrote: > I guess from my experience I feel that the business-logic is the code that > generates the attributes and such, ready to pass off to the template as > strings, hashes, and arrays. > > But once you give that information to the template, it's up to the template > to decide what to do with it. > > Here's a better example: > > For any item you put in your shopping cart, my business-programming can > give you a list of 20 items for "If you like this you will like..." > > But it's up to the visual design to decide how many of those 20 items > to show on the screen at once. I agree on this point; the template needs some basic methods to process strings, iterate over lists etc. And I think that constructing a new mini-language really makes no sense if you are already using a scripting language that can be easily embedded into the template. But what I am not yet sure about is how to do it in practice. Example: The forum has to determine which page to show (forum list, thread view, login form) based on a variable/attribute, let's call it "action". Now I could do something like this in the template (pseudo-eruby): .... <% case action %> <% when "forumlist": %> <%=include("forumlist.tpl") %> <% when "loginpage": %> <%=include("loginform.tpl") %> <% end %> .... Any better ideas?