From: Chuck E. <ec...@mi...> - 2001-04-08 14:53:22
|
At 12:45 PM 4/7/2001 -0700, Mike Orr wrote: >Why does the template class need display logic? Looping can be done with >blocks. To display big numbers in bold, do: > >### In the template. > <TD> {value_format_begin} ${value} {value_format_end} </TD> > >### In the calling program. > if real_value > 100.00: > value_format_begin = "<STRONG>" > value_format_end = "</STRONG>" > else: > value_format_begin = "" > value_format_end = "" > value = "%.2f" % real_value # Display two decimal places. I don't see any looping here... > > Also, do we want to add a "set" for convenience? > > > > [set salary value=[department.manager.salary]] > > ... > > [value salary] > >This makes "salary" a temporary plugin value? Again, it's the >responsibility of the caller to set the appropriate plugin values at >the appropriate time. Providing "set" isn't taking away the responsibility you mention. It is providing convenience for the designer who might get tired of saying "department.manager.salary" 4 times if he uses it 4 times. > > Um, and also nested tags? (I didn't mention that in my first spec.) > >By nested tags do you mean nested substitutions (loop inside the content >fragment inside the entire page)? Or what do you mean? The example was just above: [set salary value=[department.manager.salary]] Although I probably meant this: [set salary value=[value department.manager.salary]] Or based on recent discussion, this: [set salary value=[$department.manager.salary]] >I think the template class should be as simple as possible, and both >programming logic and display logic should stay in the caller. Agreed on programming logic. Still contemplating display logic. >If there is a need for enhanced values in a loop (e.g., row numbering, >totals, batches), why not have the caller use a separate class which wraps a >list and provides all those derived values that <dtml-in ...> does? Fine, but I would want that to be a default behavior. In other words, the designer would always know that he has those values available when working with a list. Again, it comes back to the fact that I work with designers in my consulting. I don't want them to have to tap me on the shoulder every time they want an index for a set of data they are looping through. That's a pain in the arse for everyone. -Chuck |