Fórum

Embed article with Freemarker

thumbnail
Jakub Bebjak, modificado 8 Anos atrás.

Embed article with Freemarker

Junior Member Postagens: 25 Data de Entrada: 16/01/14 Postagens Recentes
Hello,
Im trying embed article by id to footer section in theme based on Freemarker.

In Velocity I was using this code:
#if ($theme_settings.footer-section-article-id)
	#set ($footer_section = $journalContentUtil.getContent($group_id, $theme_settings.footer-section-article-id, null, "$locale", $theme_display))
#end


I rewrite it to Freemarker:
<#if theme_settings.footer-section-article-id>
	<#assign footer_section = journalContentUtil.getContent(group_id, theme_settings.footer-section-article-id, null, "locale", theme_display)>
<!--#if-->


But I got error: "javax.servlet.jsp.JspException: freemarker.core.NonNumericalException: Error on line 11, column 6 in nextone-theme_SERVLET_CONTEXT_/templates/init_custom.ftl Expression theme_settings.footer is not numerical Expression section is not numerical"

Would anyone help me on this, thank you...
thumbnail
Jakub Bebjak, modificado 8 Anos atrás.

RE: Embed article with Freemarker

Junior Member Postagens: 25 Data de Entrada: 16/01/14 Postagens Recentes
I found a sollution emoticon
&lt;#if theme.getSetting("footer-section-article-id")?has_content&gt;
	&lt;#assign footer_section = journalContentUtil.getContent(group_id?long, theme.getSetting("footer-section-article-id"), "", "${locale}", theme_display)&gt;
<!--#if-->
thumbnail
James Falkner, modificado 8 Anos atrás.

RE: Embed article with Freemarker

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
Jakub Bebjak:
I found a sollution emoticon
&lt;#if theme.getSetting("footer-section-article-id")?has_content&gt;
	&lt;#assign footer_section = journalContentUtil.getContent(group_id?long, theme.getSetting("footer-section-article-id"), "", "${locale}", theme_display)&gt;
<!--#if-->


Yep you cannot mention the - (minus) character in Freemarker symbols - it's interpreted as a mathematical subtraction emoticon

You also could have used theme_settings['footer-section-article-id']