Forums de discussion

ADT + Freemarker

thumbnail
Andew Jardine, modifié il y a 9 années.

ADT + Freemarker

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Hey Guys,

Stuck on something. I'm just starting to work with Freemarker -- traditionally I have worked more with Velocity. I've got a portlet and the ADT piece is working great. Now I am just trying to figure out how to get some of the template flushed out. I managed to include the portlet taglib and create a portlet url. Now what I am doing is trying to access the renderParameters.

I used the toolbar on the left so tha tin my template I have a ${renderRequest} object. Now, inside there I can see auto-complete options so I have chosen ... getParameter("myVar") so that my final markup is --


<div>${renderRequest.getParameter("myVar")}</div> 


I know. Very exciting emoticon. But when I try to render this template I am getting an error --


Expression renderRequest.parameter is undefined on line 24, column 3 in 12139#12171#106002.
1&lt;#-- 
2Application display templates can be used to modify the look of a 
3specific application. 
...
...


Which I don't understand because the UI gave me both the variable and the auto-complete.

What am I missing here?
thumbnail
Krzysztof Gołębiowski, modifié il y a 9 années.

RE: ADT + Freemarker

Liferay Master Publications: 549 Date d'inscription: 25/06/11 Publications récentes
Hello Andrew,
I've been using the following snippet to get parameters from renderRequest:
&lt;#assign currentCategoryId = paramUtil.getLong(request, "categoryId") /&gt;

Regards,
KG
thumbnail
Andew Jardine, modifié il y a 9 années.

RE: ADT + Freemarker

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Hi Krzysztof,

Thanks for the tip -- I'll give it a shot later and let you know if I have any luck. Do you have any references that you use to get through these situations? Or is it just basically crawling through LR source and the Freemarker guide?
thumbnail
Krzysztof Gołębiowski, modifié il y a 9 années.

RE: ADT + Freemarker

Liferay Master Publications: 549 Date d'inscription: 25/06/11 Publications récentes
Hmm, there is one very usefull script, published by James Falkner - https://www.liferay.com/web/james.falkner/blog/-/blogs/dumping-adt-wcm-template-variables. It saved me a lot of time emoticon If you still have problems, everything what is left is debugging Liferay's code :/

Regards,
KG
thumbnail
Andew Jardine, modifié il y a 9 années.

RE: ADT + Freemarker

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Awesome Krzysztof! I actually remembered reading that post but when I tried to find it again I couldn't. Bookmarked this time though emoticon