Forum OpenACS Q&A: Re: List builder is a mean lean html-quoting monster

Collapse
Posted by Mark Aufflick on
An important extenstion to Lars' display_template example:

If you have used the display_eval parameter in your element and then try the display_template above you will be surprised to find the original value presented.

That's because the display_eval param doesn't modify the column value, it makes a new column. Extending the above example:

...
-elements {
  success_bool {
    display_eval {[ad_decode $success_bool t Success "<em>FAIL</em>"]}
    display_template mailto:{@foo.success_bool___display;noquote@}
  }
}

Note that the separator is THREE underscore characters. In a similar way if you have constructed an url with the link_url_eval param, you can access that via col_name___link_url

If you want some insight into the upvar magic of Lars and the completeness of listbuilder functionality - take a look at the source for template::list::prepare_for_rendering !

Collapse
Posted by Lars Pind on
In this case, I'd recommend moving the 'eval' chunk into your db_multirow statement to add it as a column in the multirow, and avoid using the display_eval here. Makes things a bit cleaner.

/Lars