Hi Richard,
Thank you very much for your help. Now I succeeded to make it work, but only
for images...
After removing the taglib assignement, I had to re-write the call to the media
tag, because it couldn't recognize it anymore. So, this call : [@media.media
item="${mediaNode}" width="160" height="160" /] is now used like this: <img
src="${ctx.contextPath}${media.url(mediaNode)}" width="160" height="160"/>
The error was:
freemarker.template.TemplateModelException: No such key: media in class
net.sourceforge.openutils.mgnlmedia.media.tags.el.MediaEl
Should I have used it in some other way?
What if the media node is a video (for example). By calling [@media.media ...],
the media node would have been correclty displayed according to the media type.
So, is there another way of using the media object?
Thanks and regards from Bucharest :)
Ana
From: [email protected]
[mailto:[email protected]] On Behalf Of Unger, Richard
Sent: Tuesday, July 26, 2011 3:43 PM
To: Magnolia User-List
Subject: [magnolia-user] AW: Simplemedia taglib functions in freemarker
Hi Ana!
Don't include the taglib, ie leave out this:
[#assign media=JspTaglibs["http://net.sourceforge.openutils/mgnlMedia"]]
With the media module, the object "media" is automatically available to
freemarker, without the need to import the taglib.
If you do import the taglib, you overwrite the "media" variable, and things
stop working.
I made the same mistake a few weeks ago...
Regards from Vienna,
Richard
Von: [email protected] [mailto:[email protected]]
Im Auftrag von Ana Osman
Gesendet: Dienstag, 26. Juli 2011 12:30
An: [email protected]
Betreff: [magnolia-user] FW: Simplemedia taglib functions in freemarker
Hello,
I'm trying to use the media tags in freemarker but, for some reason, I can't
make them to be seen in my paragraph's ftl template.
Steps made for creating this paragraph:
1. I've created a media paragraph-renderer (why is it not already defined in
the media module? or is it just that I can't find it?)
name : media
class:
net.sourceforge.openutils.mgnlmedia.freemarker.SktSimpleMediaParagraphRenderer
2. I've created the paragraph definition:
dialog : samples-playlist
templatePath: templating-kit/paragraphs/content/uwImageGallery.ftl
type: media
3. I've created the freemarker template (the file is attached)
1. -> Include JspTaglibs like this:
[#assign media=JspTaglibs["http://net.sourceforge.openutils/mgnlMedia"]]
2. -> Use a media function:
assign
mediaNodes=media.mediaNodesInPlaylist(playlistNode)<http://jira.openmindlab.com/browse/MEDIA-248#assign%20mediaNodes=media.mediaNodesInPlaylist(playlistNode)>
3. -> Use a media tag:
list mediaNodes as
mediaNode<http://jira.openmindlab.com/browse/MEDIA-248#list%20mediaNodes%20as%20mediaNode>
[@media.media item="${mediaNode}" width="160" height="160" /]
/#list<http://jira.openmindlab.com/browse/MEDIA-248#list>
The result is this error:
Expression media.mediaNodesInPlaylist is undefined on line 12, column 21 in
templating-kit/paragraphs/content/uwImageGallery.ftl.
The problematic instruction:
----------
==> assignment: mediaNodes=media.mediaNodesInPlaylist(playlistNode) [on line
12, column 1 in templating-kit/paragraphs/content/uwImageGallery.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression
media.mediaNodesInPlaylist is undefined on line 12, column 21 in
templating-kit/paragraphs/worldsteel-internet/content/uwImageGallery.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
............................................................................................
If I remove the import of JspTaglib(1.) and the jsptag call(3.), then the media
function(2.) works ok.
What could be wrong?
Thank you for any suggestions,
Ana
________________________________
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to:
<[email protected]<mailto:[email protected]>>
----------------------------------------------------------------
________________________________
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------