Create a direct link to a binary file

Create a direct link to a binary file

Wednesday 28 July 2004 3:17:39 am - 4 replies

Author Message

Roy Bøhmer

Monday 02 August 2004 11:11:53 am

Sorry for the late answer. Hope you already have figured something out.
I've used this code whith success. Hope it helps.

<a href={concat("content/download/",
			$object.id,
			"/",
			$object.data_map.file.id,
			"/file/",
			$object.data_map.file.content.original_filename)|ezurl}>
			{$object.name|wash}</a>

You should replace <i>$object</i> with <i>$:item.object</i> and ensure that the attributename for the binary file in the class is file. If not, replace <i>file</i> with the attributename.

Roy

Nicolas Heiringhoff

Tuesday 03 August 2004 4:00:30 am

Hello Roy,

your code works perfectly fine!

Thank you very much!

Nicolas

http://www.heiringhoff.de

willy jansen

Monday 15 November 2004 9:39:12 am

Congratulations! Would you mind explaining how you solved this and what code you used. For at least one person (me) is looking for a similar solution, but the information above is not sufficient for me.

Nicolas Heiringhoff

Tuesday 16 November 2004 12:17:02 am

Hello Willy,

We put the files (pdfs in our case) in one folder (node id 296).
With the following code we can display the pdfs with a direct download link in a template.


{* Fetch everything that is under node #296 (children, grand-children, etc.) *}
{let nodes=fetch( 'content', 'tree', hash( 'parent_node_id', 296 ) ) }

{* Loop through the nodes and display their names. *}
{section loop=$nodes}


<br />

<span class="fett">{$:item.data_map.titel.data_text}</span>

<br />

{$:item.data_map.beschreibung.data_text}

<br />

<img src={"pdf_mini_icon.png"|ezimage}&nbsp; &nbsp; 

<a href={concat("content/download/",
                        $:item.object.id,
                        "/",
                        $:item.object.data_map.file.id,
                        "/file/",
                        $:item.object.data_map.file.content.original_filename)|ezurl}>
                        {$:item.object.name|wash}</a>

    <br />   
{/section}



{/let}

Regards,
Nico

http://www.heiringhoff.de

You must be logged in to post messages in this topic!

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