掲示板

Embed article with Freemarker

thumbnail
8年前 に Jakub Bebjak によって更新されました。

Embed article with Freemarker

Junior Member 投稿: 25 参加年月日: 14/01/16 最新の投稿
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
8年前 に Jakub Bebjak によって更新されました。

RE: Embed article with Freemarker

Junior Member 投稿: 25 参加年月日: 14/01/16 最新の投稿
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
8年前 に James Falkner によって更新されました。

RE: Embed article with Freemarker

Liferay Legend 投稿: 1399 参加年月日: 10/09/17 最新の投稿
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']