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

eZ debug

Timing: Jan 18 2025 16:13:06
Script start
Timing: Jan 18 2025 16:13:06
Module start 'content'
Timing: Jan 18 2025 16:13:07
Module end 'content'
Timing: Jan 18 2025 16:13:07
Script end

Main resources:

Total runtime1.0831 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.8438180.8359
Module start 'content' 0.00610.9117 769.6797573.8672
Module end 'content' 0.91780.1652 1,343.5469336.7734
Script end 1.0831  1,680.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00510.4703210.0002
Check MTime0.00180.1637210.0001
Mysql Total
Database connection0.00060.052310.0006
Mysqli_queries0.997292.06771940.0051
Looping result0.00200.18451920.0000
Template Total1.053797.320.5269
Template load0.00240.220820.0012
Template processing1.051397.062220.5256
Template load and register function0.00010.010010.0001
states
state_id_array0.00180.167610.0018
state_identifier_array0.00090.082720.0004
Override
Cache load0.00220.1986960.0000
Sytem overhead
Fetch class attribute can translate value0.00140.127630.0005
Fetch class attribute name0.00150.137740.0004
XML
Image XML parsing0.00100.091630.0003
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00260.2399270.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 47
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs