cancel
Showing results for 
Search instead for 
Did you mean: 

Solved: ${name} in freemarker template

mvlach
Champ in-the-making
Champ in-the-making
Hi,


is there any possibility to get the name of the webform ? Let's imagine:

I have webform news and create the content news1. Freemarker render news1.xml to news1.html - and i would like to know the name "news1" in the template.

Is this possible ?

Thanks Mila
10 REPLIES 10

mikef
Champ in-the-making
Champ in-the-making
Have you tried:

${name}

mvlach
Champ in-the-making
Champ in-the-making
Yes, i have tried this Smiley Happy

M.

janv
Employee
Employee
One of the following can be used:

${alf.form_instance_data_file_name}
${alf.rendition_file_name}

In your case, these we will return "news1.xml" and "news1.html" so you will need to strip off the file suffix.

See also:

http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Rendering_engine_variables_and_functions

Regards,
Jan

vijay_alfresco
Champ in-the-making
Champ in-the-making
This is good, but can I know the renedition names and associated xml file in the deployment server code?

Thanks,
Vijay

zaizi
Champ in-the-making
Champ in-the-making
Yes. If you are doing an Alfresco to Alfresco deployment. If you are doing an Alfresco to File Server deployment, then you'll just have a bunch of files on the file system.

What is it that you are trying to do?

Ainga

tommorris
Champ in-the-making
Champ in-the-making
Ainga is correct.

The web-form AVM nodes holding the XML, contains a collection property called "{http://www.alfresco.org/model/wcmappmodel/1.0}renditions" with a list of the generated rendition files associated with this web-form. Whilst the rendition nodes themselves have the property "{http://www.alfresco.org/model/wcmappmodel/1.0}primaryforminstancedata" that points back at the web-form XML instance that created it.

Alternatively, you could embed the info in the rendition output, possibly into an accompanying custom XML file.

Tom
http://www.ixxus.com

vijay_alfresco
Champ in-the-making
Champ in-the-making
Yes. If you are doing an Alfresco to Alfresco deployment. If you are doing an Alfresco to File Server deployment, then you'll just have a bunch of files on the file system.

What is it that you are trying to do?

Ainga

ok, but given a webform (comes as .xml file in deployment server), I want to know the associated reneditions and mimetypes or just the file names of the rendered files asssociated to the xml. I am using Alfresco to File system deployment and I know I'll get all the files even the rendered files in the deployment server, but I want to get the associated files for a
given .xml file (webform output).

Thanks you,
Vijay

zaizi
Champ in-the-making
Champ in-the-making
Right. There are two options to look up associations;

1. Hard code the locations. If you are generating the renditions in the same location as the .xml file or at a relative location, then you can just look it up. An example would be that renditions are of the same name in a sub folder called "renditions'. If the .xml file is in /somefolder/my.xml, the rendition would be in /somefolder/renditions/my.html (if the rendition is an html file).

2. Given the .xml file use webscripts to call back to you Alfresco installation to look up the associated files and renditions.

tommorris
Champ in-the-making
Champ in-the-making
Yeah - and if you're stuck with solution 1 outlined above, I would try something like:
  my-webform-instance.xml
  my-rendition-1.html
  my-rendition-2.jsp
  my-webform-instance-meta.xml

Where the first form is the actual output of the web form, and the following three files are renditions.
The last rendition in this example contains any associated meta-data about the web-form.
By using a consistent notation (i.e. use the same name as the web-form, but with the '-meta' suffix) you can find the file to query.