[b]Good grief![/b]

I got it finally!
Federico and Tobias, you said your code is right, but why didn't it work for 
me? 

Your code:

[code]<c:choose>
        <c:when test="${not empty content.image}">
                Image: <img src="${cmsfn:link(content.image)}" />
        </c:when>
        <c:otherwise>
                Image: No image uploaded yet.
        </c:otherwise>
</c:choose>[/code]

Did you use the "dam" control for testing it? And did you upload a file or did 
you browse in the dms? I did the latter. "${content.image}" is returning a 
String with the value "dms" then. So your code couldn't work since the 
[url=http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5.1/magnolia-templating-jsp/tlddoc/cmsfn/link.fn.html]link
 method[/url] is expecting a parameter of the type 
info.magnolia.jcr.util.ContentMap. So I received the error message that "dms" 
is a String and not a ContentMap of course. Again: How is this working for you?

So I tried passing a ContentMap using the 
[url=http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5.1/magnolia-templating-jsp/tlddoc/cmsfn/asContentMap.fn.html]asContentMap[/url]
 method which is in turn expecting a javax.jcr.Node which I tried passing 
through the 
[url=http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5.1/magnolia-templating-jsp/tlddoc/cmsfn/content.fn.html]content[/url]
 method. This is expecting two Strings, a "path" and a repository. So in the 
end my code looked like this:
<img src="${cmsfn:link(cmsfn:asContentMap(cmsfn:content(content.imageDmsUUID, 
'dms')))}" alt="error" />

This was unfortunately not working, I really don't know why, to be honest: this 
is just a little messed up in my opinion...The I came up with the 
[url=http://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/ref/4.5.1/magnolia-templating-jsp/tlddoc/cmsfn/linkForWorkspace.fn.html]linkForWorkspace[/url]
 method.

To cut a long story short, this line made my day:

[b][code]<img 
src="${cmsfn:linkForWorkspace(content.image,content.imageDmsUUID)}" alt="error" 
/>[/code][/b]

Any clarification is appreciated...

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=2b969df8-d962-45e4-a2fd-ebae14ba2fa7


----------------------------------------------------------------
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]>
----------------------------------------------------------------

Reply via email to