FreeMarker template error

312 views
Skip to first unread message

Atul Dongre

unread,
May 26, 2016, 3:53:46 AM5/26/16
to CrafterCMS
Hi,

I have faced bellow error when i have added the In-Context editing pencil code in ftl file.
I have created a content model and associated template for each page type.
- In the site content panel under the pages folder:  Right click on the parent page (home) and select create content. 
- Choose the content type
- Fill out the form and save
If I click on left side link(like About Us) then editing work fine but same when i click on top menu(About Us) and sub menu in case throws bellow exception.

FreeMarker template error:
The following has evaluated to null or missing:
==> model  [in template "templates/web/infrastrucure.ftl" at line 74, column 87]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault
, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cove
r the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> ${model.title1}  [in template "templates/web/infrastrucure.ftl" at line 74, column 85]
----------

Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
        at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
        at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:41)
        at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:24)
        at freemarker.core.Dot._eval(Dot.java:81)


Thanks
Atul Dongre

Deepesh Nandal

unread,
Jun 13, 2016, 5:45:04 AM6/13/16
to CrafterCMS
Hi,
  This means there is no field with name 'title1' on that editor form which loads infrastructure.ftl . I would suggest to edit content type and see if that field has been named to something else and is not called 'title1' now.

Thanks,
Deepesh Nandal.

Russ Danner

unread,
Jun 13, 2016, 10:41:14 AM6/13/16
to Deepesh Nandal, CrafterCMS
I agree.

Another approach is to check and see if the definition has the field but the author has not filled out the field.  You can check this by editing the content.

Lastly you can change your template to look something like this ${model.title1!"NO VALUE"}  and this will display "NO VALUE" instead of throwing an error.

/R

----
Russ Danner, Vice President, Products


--
You received this message because you are subscribed to the Google Groups "CrafterCMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to craftercms+...@googlegroups.com.
Visit this group at https://groups.google.com/group/craftercms.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages