Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

Here is the main official document of Apache Freemarker:
https://freemarker.apache.org/docs/index.html

Freemarker is used for the two purposes in OFBiz.

- Create HTML page.
- Create templates using FTL - XML document, CSV, JSON.

Basically we come across the following topics in Freemarker while working in Apache OFBiz project.
You can refer the following FTL files in OFBiz to check the usage of all the things mentioned below:
- OrderList.ftl
- OrderItems.ftl

- Macros
https://freemarker.apache.org/docs/ref_directive_macro.html


A few Macro examples used in OFBiz
A few macros used in OFBiz:

<@ofbizCurrency amount=orderAdjustmentsTotal isoCode=shoppingCart.getCurrency() />

<@ofbizUrl>
<a href="<@ofbizUrl>OrderDeliveryScheduleInfo?orderId=${orderHeaderAndRole.orderId}</@ofbizUrl>" class='buttontext'>Schedule Delivery</a>

<@ofbizContentUrl>
<#list layoutSettings.styleSheets as styleSheet>
  <link rel="stylesheet" href="<@ofbizContentUrl>${StringUtil.wrapString(styleSheet)}</@ofbizContentUrl>" type="text/css"/>
</#list>

For macros implementation refer the following files in OFBiz:
- OfbizCurrencyTransform.java
- OfbizUrlTransform.java
- OfbizCurrencyTransform.java

has_content:

https://freemarker.apache.org/docs/ref_builtins_expert.html#ref_builtin_has_content

Default Value Operator(!)
https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_default

Missing Value Test Operator(??)
https://freemarker.apache.org/docs/dgui_template_exp.html#dgui_template_exp_missing_test

List directive(<#list>)
https://freemarker.apache.org/docs/ref_directive_list.html


Assign directive (<#assign>)
https://freemarker.apache.org/docs/ref_directive_assign.html

How to call a static method in Freemarker:

<#assign orh = Static["org.apache.ofbiz.order.order.OrderReadHelper"].getHelper(orderHeader)>


The following implicit objects are made available in Freemarker in OFBiz framework.


- request
- response
- session
- parameters
- context
- userLogin
- locale

  • No labels