Forums / Setup & design / folder -> subfolder -> file download

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