Hi Adrien, Looks good to me. Only caveat is that that the DAM is theoretically extensible (for example, the OpenMind SimpleMedia module adds the "media" DAM type) , and you would need to adapt your templates for this case. But normally that won't be a problem as it is not a normal thing to add new DAM types.
As an additional tip we found it useful to implement this kind of functionality as a freemarker macro or function (see the freemarker manual for more infos on this). In this way we avoid duplicating the cumbersome code-block when we have more than one image to include, and the code at the point of inclusion simply becomes something like: [@safeImageUrl content "image" /] Regards from Vienna, Richard -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von adrien beber (via Magnolia Forums) Gesendet: Dienstag, 22. Jänner 2013 14:52 An: Magnolia User List Betreff: [magnolia-user] Re: DAM control: how to check if link present for dms OR file present for upload Thanks a million, just restarting to use Magnolia & you saved my computer from a jump from the 6th floor :) Going through the JCR Browser was really easy. Thanks for the tip, will use it again I'm sure. Here is the NullPointerException proof code to display data coming from the DAM controlType then: [code][#if item?has_content && item.image?has_content && ((item.image=="upload" && item.imageBinary?has_content) || (item.image=="dms" && item.imageDmsUUID?has_content))] ...do your stuff [/#if][/code] The way I implemented it, could probably be improved: [code][#if item?has_content && item.image?has_content && ((item.image=="upload" && item.imageBinary?has_content) || (item.image=="dms" && item.imageDmsUUID?has_content))] [#assign imageLink = stkfn.getAssetVariation(stkfn.getAsset(item, "image"), "itemlist").getLink()!""] [#if imageLink?has_content] <img class="itemImg" src="${imageLink!}" alt="${item.name!}" /> [#else] <div class="itemImg dummyImg"></div> [/#if] [#else] <div class="itemImg dummyImg"></div> [/#if][/code] -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=031616df-1f91-4512-95ec-8a5e237ad1f5 ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
