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:

Example

controller.erl

  ...
  print_date() ->
      wpart:fset("date", tuple_to_list(date())),
      {template, "templates/date.html"}.
  ...

date.html

  ...
      Today is <wpart:lookup key="date" />!
  ...

Wparts/WpartLookup (last edited 2010-06-24 12:49:27 by KrzysztofGoj)