I just found html::template and it's exactly what I was looking for. The
only thing that is a minor shortcoming for me is the inability to do option
select lists. I understand the emphasis on keeping a template a template
(and languages separate). But, here's an example of why I believe it is
justifiable to provide for an "if" inside the variable loop that would emit
an option list.

The reason I like template is that I would like to serve relatively static
pages, many with forms, localized to languages. I'd like to have an "en"
directory for English pages, "es" for Spanish, etc. Static content can be
translated and maintained in those directories. A script can display the
correct language depending on a visitor's language preference. I don't see
any other tools that make it as *easy* to do this as template does.

But, let's say a page will have a form and in that form will be a select
list. Let's say the list is "sex" and the choice is male or female. Across
all the localized pages I intend to use value "1" and "2", but I want the
displayed text to localized (example: "Hombre" or "Mujer" if the templates
in the "es" directory are being processed.)

I believe, to accomplish this I must create a MySQL table named "sexes" and
maintain the relationship between "1" and "2", the language codes, and the
values for the language. Then, in my script I would select the words to
display in the select list and output the entire select list as a variable
to be replaced in the template.

That's not a showstopper for me. It's a valid way to do it too. My only
point is, I don't believe I should have to go through the overhead of
selecting static language-dependent values from a table when I'd be
perfectly happy hard-coding them in the language-specific instances of the
template. They aren't going to change. But, I have to have some way to set
"selected" depending on whether the value is "1" or "2" (my language
independent enumeration).

I believe this is a valid case where the absense of an if requires me to
move template-type information (static) somewhere else. The only thing that
changes is the choice value.

Am I on the right track if I use template::expr inside an options list and
test at each option to know if I should emit the selected attribute?

Anyway, it's a terrific tool. I just wanted to say that it seems like
there's valid uses for some logic in the template and it shouldn't be
disparaged the way a lot of the documentation seems to. (Just my 2-cents. I
love the tool, really!).

Thanks,
Mark



-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to