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.

eZ debug

Timing: Jan 18 2025 20:51:42
Script start
Timing: Jan 18 2025 20:51:42
Module start 'layout'
Timing: Jan 18 2025 20:51:42
Module start 'content'
Timing: Jan 18 2025 20:51:44
Module end 'content'
Timing: Jan 18 2025 20:51:44
Script end

Main resources:

Total runtime1.4297 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.0469152.6406
Module start 'layout' 0.00540.0031 740.687539.4766
Module start 'content' 0.00851.4198 780.1641563.6250
Module end 'content' 1.42830.0014 1,343.789116.1250
Script end 1.4297  1,359.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00290.2050160.0002
Check MTime0.00120.0842160.0001
Mysql Total
Database connection0.00080.054110.0008
Mysqli_queries1.373096.0347600.0229
Looping result0.00060.0429580.0000
Template Total1.395997.620.6979
Template load0.00210.146120.0010
Template processing1.393897.485320.6969
Template load and register function0.00010.008110.0001
states
state_id_array0.00090.064710.0009
state_identifier_array0.00100.066820.0005
Override
Cache load0.00180.1243260.0001
Sytem overhead
Fetch class attribute can translate value0.00070.048820.0003
Fetch class attribute name0.00100.069460.0002
XML
Image XML parsing0.00120.086920.0006
class_abstraction
Instantiating content class attribute0.00000.001480.0000
General
dbfile0.00170.1217250.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs