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

Reply via email to