This is a general syntax question - apologies if it is too general for this list.

In a foreach-loop through a list of information about persons, I want to print out the name of a person only if no entry for that person has been printed before. This is the case if no entry with precisely the same first name and the same last name has been printed right before the present one.

Initially I had set up the loop like this:

<% foreach g in guests %>
<% if printed_name == g.lastname) %>
<p><% if g.title %><% g.title %> <% end %><% g.firstname %> <% g.lastname %><br/>
Institution: <% g.Institution %><br/>
<% set printed_lastname = g.lastname %>
<% end %>
Zeit: <% g.Datum %><br/>
Finanzierung: <% g.Finanzierung %><br/>
Aktivit&auml;t: <% g.Beschreibung %>.
</p>
<% end %>

Now I have a case with two people with the same last name, but different first names. I thought I should best set the variable "printed_lastname" to a string consisting of g.firstname and g.lastname, and then test against that, but what syntax can I use?

<% set printed_lastname = 'g.firstname g.lastname' %># interprets variable values as literals
<% set printed_lastname = g.firstname g.lastname %># produces syntax error

Thanks in advance,

Birgit Kellner





_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to