folder -> subfolder -> file download

Author Message

Alessandro Cipriani

Monday 02 February 2004 8:13:18 am

hi all
i need to display my hierarchy as follows

folder
--subfolder1
---file11.pdf
---file12.pdf
--subfolder2
---file21.pdf

for folder and subfolder i overrided the folder.tpl file, and it works perfectly
this is the myfolder.tpl code:

<form method="post" action={"content/action"|ezurl}>

<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.object.id}" />
<input type="hidden" name="ViewMode" value="full" />

{section show=$node.object.can_edit}
<div class="editbutton">
<input class="button" type="submit" name="EditButton" value="{'Edit'|i18n('design/standard/node/view')}" />
</div>
{/section}

<h1>{$node.name}</h1>

<div class="object_content">
{attribute_view_gui attribute=$node.object.data_map.description}
</div>

{let page_limit=20
children=fetch('content','list',hash( parent_node_id, $node.node_id,
sort_by ,$node.sort_array,
limit, $page_limit,
offset, $view_parameters.offset))}

{section name=Child loop=$children }

<div class="ricorsivachild">
{*<a href={concat("/content/view/full/", $Child:item.node_id,"/")|ezurl}>*}{$Child:item.name|wash}{*</a>*}<br>

{let subfolder_list=fetch('content','list',hash(parent_node_id,$Child:item.node_id))}

{section name=Subfolder loop=$Child:subfolder_list}
 <a href={concat("/content/view/full/",$Child:Subfolder:item.node_id,"/")|ezurl}>
{$Child:Subfolder:item.name|wash}</a><br>
{/section}
{/let}
</div>
{/section}
{/let}
{/default}
</form>

in such a way every folder displays its content and the link to it

the problem is that i'd like to avoid to display the link to the ezfile contained into the subfolder, but directly to the pdf, in order to download it without accessing another page (the ezfile page.)
i'd like to download the file directly from the folder

any hint? how should i edit the code above in order to get the result i want?
thanx a lot
alessandro

Lazaro Ferreira

Monday 02 February 2004 2:11:46 pm

Hi,

You should pickup the file objects from loop, i.e:
{section show=eq($Child:Subfolder:item.object.contentclass_id,'the_id_of_your_file_class')}
{* Here the code that shows the download links *}
{/section}

,then select the attribute 'File' of the file object and add a code like :
{* code to show download link *}
<a href={concat("content/download/",$attribute.contentobject_id,"/",$attribute.id,"/file/",$attribute.content.original_filename)|ezurl}>{$attribute.content.original_filename|wash(xhtml)}</a> {$attribute.content.filesize|si(byte)}

The code above is used by ezpublish to render the link to download the file in the ezfile view template, you have to change the $attribute variavel to your own, i.e: $Child:Subfolder:item.object.data_map.File

Hope this help

Lazaro
http://www.mzbusiness.com

Alessandro Cipriani

Tuesday 03 February 2004 1:21:23 am

hi lazaro

i think i didn't understand at 100% your answer, anyway i send you the modified code, please tell me if it is right or not...
anyway it doesn't work...

<div class="object_content">
{attribute_view_gui attribute=$node.object.data_map.description}
</div>

{let page_limit=20
children=fetch('content','list',hash( parent_node_id, $node.node_id,
sort_by ,$node.sort_array,
limit, $page_limit,
offset, $view_parameters.offset))}

{section name=Child loop=$children }

<div class="ricorsivachild">
{*<a href={concat("/content/view/full/", $Child:item.node_id,"/")|ezurl}>*}{$Child:item.name|wash}{*</a>*}<br>

{let subfolder_list=fetch('content','list',hash(parent_node_id,$Child:item.node_id))}

{section name=Subfolder loop=$Child:subfolder_list show=eq($Child:Subfolder:item.content.class_id,12)}
<a href={concat("content/download/",$Child:Subfolder:item.data_map.File.contentobject_id,"/",$$Child:Subfolder:item.data_map.File.id,"/file/",$Child:Subfolder:item.data_map.File.original_filename)|ezurl}>{$Child:Subfolder:item.data_map.File.original_filename|wash(xhtml)}</a>
{$attribute.content.filesize|si(byte)}
 


{*<a href={concat("/content/view/full/",$Child:Subfolder:item.node_id,"/")|ezurl}>
{$Child:Subfolder:item.name|wash}</a><br>*}

{/section}
{/let}
</div>
{/section}
{/let}

thanks a lot
alessandro

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 19:10:02
Script start
Timing: Jan 18 2025 19:10:02
Module start 'layout'
Timing: Jan 18 2025 19:10:02
Module start 'content'
Timing: Jan 18 2025 19:10:03
Module end 'content'
Timing: Jan 18 2025 19:10:03
Script end

Main resources:

Total runtime1.6826 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 589.0313152.6250
Module start 'layout' 0.00780.0051 741.656339.4609
Module start 'content' 0.01291.6680 781.1172568.7891
Module end 'content' 1.68080.0017 1,349.906316.1563
Script end 1.6825  1,366.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.2061160.0002
Check MTime0.00140.0854160.0001
Mysql Total
Database connection0.00130.078010.0013
Mysqli_queries1.599595.0634570.0281
Looping result0.00070.0408550.0000
Template Total1.616196.020.8080
Template load0.00230.137120.0012
Template processing1.613895.911120.8069
Template load and register function0.00010.007010.0001
states
state_id_array0.00260.152310.0026
state_identifier_array0.00420.251320.0021
Override
Cache load0.00210.1235960.0000
Sytem overhead
Fetch class attribute can translate value0.00060.033520.0003
Fetch class attribute name0.00250.145840.0006
XML
Image XML parsing0.00060.036720.0003
class_abstraction
Instantiating content class attribute0.00000.000850.0000
General
dbfile0.00070.0433160.0000
String conversion0.00000.000840.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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
19content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
21content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs