You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by "Robert G." <ga...@mercon24.de> on 2012/12/24 15:52:12 UTC

subcontent inf FTL when exists

hey, 

I get content from Database with:

<@renderSubContent subContentId="SOME_CONTENT_ID" />

this works fine as long as this resource exists. But is there a possibility
to check if it exists to avoid error messages?

I mean sth like "?if_exists" like the check with FTL variables.





--
View this message in context: http://ofbiz.135035.n4.nabble.com/subcontent-inf-FTL-when-exists-tp4638469.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: subcontent inf FTL when exists

Posted by "Robert G." <ga...@mercon24.de>.
ok, thank you. That was I the way I thought it works, but I wanted to check
out each possibility to not to define the weel twice :)

thanks



--
View this message in context: http://ofbiz.135035.n4.nabble.com/subcontent-inf-FTL-when-exists-tp4638469p4638547.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: subcontent inf FTL when exists

Posted by Nicolas Malin <ma...@librenberry.net>.
Hi Robert,

You have two choices :
1. improve the macro to check the real existance of content
2. add before call the macro some code like this :
<#if SOME_CONTENT_ID?has_content>
<#assign content=delegator.findOne( "Content", 
org.ofbiz.base.util.UtilMisc.toMap("contentId", SOME_CONTENT_ID), true)/>
<#if content?has_content><@renderSubContent 
subContentId="SOME_CONTENT_ID" /> </#if>
</#if>

Nicolas
Robert G. a écrit :
> hey,
>
> I get content from Database with:
>
> <@renderSubContent subContentId="SOME_CONTENT_ID" />
>
> this works fine as long as this resource exists. But is there a possibility
> to check if it exists to avoid error messages?
>
> I mean sth like "?if_exists" like the check with FTL variables.
>
>
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/subcontent-inf-FTL-when-exists-tp4638469.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.


-- 
Nicolas MALIN
Consultant
Tél : 06.17.66.40.06
Site projet : http://www.neogia.org/
-------
Société LibrenBerry
Tél : 02.48.02.56.12
Site : http://www.librenberry.net/