FTL Templates

17 Apr

Template to use FTL write, is a combination of the following:

• Text: direct output

• Interpolation: $ {} or # {and} to qualify, the calculated value alternative output

• FTL mark: the FreeMarker instruction, and HTML tags similar to be distinguished name before the #, not output

• Note: <# – and -> limited, not output the following is based on the a specific template examples: <html> <head> <title> Welcome! </ Title> </ head> <body> <# – – Greet the user with his / her name -> <h1> Welcome $ {user}! </ h1> <p> We have these animals: <ul> <# list animals as being> <li> $ {being. name} for $ {being.price} Euros </ # list> </ ul> </ body> </ html>

Note: • FTL case-sensitive, so the list is correct FTL instruction, the List is not;

$ {name} and $ {NAME} is different

• Interpolation can only be used in the text

The FTL mark can not be in another FTL marked internal, such as: <# if <# include ‘foo’> = ‘bar’> … </ if>

• Comments can be located FTL tag Interpolation internal, as in the following example: <h1> Welcome $ {user <# – The name of user ->} </ h1> <p> We have these animals: <ul> <# list <# – some comment … -> animals as <# – again … -> being> …

I whitespace will be removed in the template output

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: