wpart_lookup
wpart_lookup grants access to previously set variables inside a view.
Variables should be prepared by calling wpart:fset function.
Attributes
key
Specifies the key which the value should be fetched from.
format
Sets the optional formatter.
type
Setting type to "html" or "cdata" turns off html-escaping. This is dangerous and may allow various html injection attacks on your website. Not specifying type or setting it to "text" turns html-escaping on.
Known Issues
If utf8-encoded string (list of utf8 bytes) is provided to this wpart, it would be double-encoded. Fixes:
be EEP 10-compilant and use unicode lists (lists of unicode code points)
use wpart_lookup_unbreak as a hackish workaround
Example
controller.erl
...
print_date() ->
wpart:fset("date", tuple_to_list(date())),
{template, "templates/date.html"}.
...
date.html
...
Today is <wpart:lookup key="date" />!
...