ezmedia, content/download and hidden nodes

Author Message

Marko Žmak

Tuesday 27 February 2007 3:50:54 am

I came across this issue today. I have a hidden folder in eZ from which I extract some media content to display on a specific part of my page. The folder MUST be hidden because I don't want the users to see this media content in regular way (content/view/full) but only in that particular part of the page.

The media content consist of some nodes that have the ezmedia attribute (some flash animations). So when I try to display that attribute of the fetched nodes I get "Object not available" error. I find out that this is because the nodes i fetched are hidden and the link to the media is something like this:

index.php/<mysiteaccess>/content/download/144/814/242_final.swf.

So I made a copy of content/datatype/view/ezmedia.tpl template and modified this link to:

concat("/",$attribute.content.filepath)

which then becomes something like this:

/var/<mysiteaccess>/storage/original/application/660933d95758c5b4b7d9848b3b9bfd37.swf

And now it works. But I'm wondering is this the safe way to do it since the original template is not made this way? And the difference is not so trivial. The original links calls index.php so the file goes through eZ engine, while the second link bypasses the eZ engine and gives just the file.

Are there any reasons why I shouldn't use the second link?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

André R.

Tuesday 27 February 2007 6:53:06 am

On the second link there is no user access checking involved.

An alternative method could be to put the flash objects inside folders that do not show children. And if you are afraid someone would guess the node id you can also override full/flash.tpl to state that flash files are not viewable in full view.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Marko Žmak

Tuesday 27 February 2007 7:17:34 am

Yes I know I could do that, but in this folder (and it's subfolders) I have other contents (besides this flash nodes) that have to be hidden. So basically I should create overrides for all this types which seems like too much work. Having this nodes hiddens seems like the most elegant sollution to me.
Also, getting the flash from a plain file instead of getting it from the eZ engine speeds up my site a little bit.

Checking user acces on the second link doesn't bother me since the user acces for this content is checked on node level. Also, on this site I want this flash animations to be available to all users (including anonymous).

What I would like to know is how safe is to use the "filepath" attribute? Could this attribute change in the future so that my template won't work? Or is there some other reason why I shouldn't use it?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

André R.

Tuesday 27 February 2007 11:19:44 am

It shouldn't be any problems using this method, as long as you don't change the siteaccess name and so.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.