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AUjyRocUK7XlgAkmdHkXWuj3PZcb2fd641ySid7fioC1aelwlrsi5YADLBbdNkLI+5GIFD7lvsqADCPI8sjE0gO1rStFjNHnQNpPk0ToOEIgQIwBT2kZSmYhoJcaDM6Nsm4eCkElMQKjOF9OmSmthmbUyZlsrtHKlaSADq0DwAgLMw/Vyoq7AmN0/zIDIuRYga31A1G3e6l84dYP3j+ptUyJt525D+s2yAlbwA730DZ7VsyTJXSMEOoisKW8BcPggyauAquINAdiWPi+IACwAKKPI8KduAAnNwACO7WhDYfA8JiugiCXmCQFAEEAuGei0AAjAADMIYh2DXassRU3pAA

Field output rendering


Any field can be outputed in its simplest form:  {%=<fieldname>%}

The output will be converted to a string using the default Javascript method.

The Whacky Framework has a lot more options and/or rendering methods that you can apply to a field, Multiple functions can be used to transform the output required to your needs.


An example could be: {%=title|string:trim,lowercase,capitalizefirstletter%}



FIELD Syntax


{%=<fieldname>|<type>:<function1>,<function2>%}


Fieldtypes:

  • string
  • date
  • number
  • bytes

Fieldtype: STRING

The string type has a lot of functions to transform the field into the desired format:

Because there are a lot of functions, you can use multiple functions.


lowercase


uppercase


trim


capitalizefirstletter



strleft

example:  {%=<field name>|string:strleft(4)%}


strright

examples: {%=<field name>|string:strright(4)%}

{%=<field name>|string:strright(" ")%}


substr

example:  {%=<field name>|string:substr(2,4)%}

"abcdefg" becomes "cdef"


truncate

example: {%=<field name>|string:truncate(10)%}   
which gives the first 10 characters only


striphtml

This uses the function _wf._stripHtmlTags();

see https://stackoverflow.com/questions/295566/sanitize-rewrite-html-on-the-client-side/430240#430240


encodeURIComponent

uses the javascriptfunction: encodeURIComponent()


decodeURIComponent

uses the javascriptfunction: decodeURIComponent()


htmlspecialchars

escapes the following characters:

" => &quot;

' => &#039;

< => &lt;

> => &gt;


escapedblquotes

javascript: split('\\"').join('"').split('"').join('&quot;');


unescapedblquote

javascript: .split('\\"').join('"');


urlescapedblquotes

example: {%=fldtitle|string:urlescapedblquotes%}

javascript: .split('\\"').join('"').split('"').join('%22');


jsonstring

javascript: JSON.stringify(<data>);


b64_encode

javascript: _wf.calc.b64_encode(<data>);

added in version 3.7.5


b64_decode

javascript: _wf.calc.b64_decode(<data>);
added in version 3.7.5


Fieldtype: date


The data provided can be two types:


  • POSIX number
  • ISO datetime string

Note: If the data is invalid, an empty string will be rendered !


Example:   {%=createdate|date:<format>%}


Where the format parameters can be:


Note: If no format was specified, the defaults from _wf.i18n are used.


Fieldtype: number


{%=<field>|number:2,3,'.',','%}

The function has the following parameters:

<number of digits behind the ,>
<separator size before the, usually thousand e.g. 3 >

<thousand separator character>
<comma separator character>


Example: {%=amount|number:2,3,'.',','%}


output = 12.345,00


Default:

The default settings can be found in the variable: _wf.i18n.number

Note: If no format was specified, the defaults from _wf.i18n are used.

Fieldtype: bytes


format: {%=<field>|bytes%}

This function has NO functions or parameters.

it will automatically create a string like  1.5 MB