Accessing node object in freemarker template
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2014 10:08 PM
I want to make an ajax call to a webscript in a freemarker template. Is there any example or guidelines about how to do this?
Is it possible to access node object and its properties such as original id into freemarker template?
Thanks
Is it possible to access node object and its properties such as original id into freemarker template?
Thanks
Labels:
- Labels:
-
Archive
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 12:49 AM
Yes you can access those things in ftl provided it is being passed through model from javascript.
Are you talking about stand alone js?
http://wiki.alfresco.com/wiki/FreeMarker_Template_Cookbook
For ajax call you can include script tags which will hold javascript function within which you can have ajax call.
Are you talking about stand alone js?
http://wiki.alfresco.com/wiki/FreeMarker_Template_Cookbook
For ajax call you can include script tags which will hold javascript function within which you can have ajax call.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 03:16 AM
Thanks that worked for me. Still not sure how to access node object.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 06:27 AM
If you see this example in that link
"companyhome.children" return you list of nodes which you are iterating. So, this is nothing but node only.
<table> <#list companyhome.children as child> <#if child.isContainer> <tr> <td><img src="/alfresco${child.icon32}"></td> <td><b>${child.properties.name}</b> (${child.children?size})</td> </tr> </#if> </#list> </table>
"companyhome.children" return you list of nodes which you are iterating. So, this is nothing but node only.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2014 09:54 PM
My freemarker template is for custom form control for alfresco share.
Neither companyhome nor node object is available in freemarker template.
I get companyhome and node not defined error.
Neither companyhome nor node object is available in freemarker template.
I get companyhome and node not defined error.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2014 05:25 AM
Those objects will be available in alfresco repository context only not in share context.The example which you had checked on that link are related to alfresco repo context ftl.
So, for share flow is like you have to pass everything from javascript controller which in turn call alfresco repository webscripts and get data. then pass that to ftl through model.
So, for share flow is like you have to pass everything from javascript controller which in turn call alfresco repository webscripts and get data. then pass that to ftl through model.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2014 11:28 PM
I have found the answer. ${form.arguments.itemId} gives me workspace://SpacesStore/a7288a57-ae57-4345-8c8b-ce798266a210
Now i need to get only id bit a7288a57-ae57-4345-8c8b-ce798266a210
Now i need to get only id bit a7288a57-ae57-4345-8c8b-ce798266a210
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2014 11:59 PM
