subcontent inf FTL when exists

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

subcontent inf FTL when exists

Robert Gan
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.

Reply | Threaded
Open this post in threaded view
|

Re: subcontent inf FTL when exists

Malin Nicolas
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/

Reply | Threaded
Open this post in threaded view
|

Re: subcontent inf FTL when exists

Robert Gan
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