Forums / Setup & design / Linking directly to a file

Linking directly to a file

Author Message

Mark Emms

Thursday 31 May 2007 4:41:13 am

I want to be able to link to a file, like an mp3 for instance, without the link opening a new page that contains a link to the file to allow its download. The user needs to be able to enter some text and then make that text point directly to a file's url (but not by having to enter a url manually - rather by browsing to find the file or uploading it)

André R.

Thursday 31 May 2007 5:02:40 am

You have to make an override for the embed template.

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

Mark Emms

Thursday 31 May 2007 5:39:53 am

I guess I can take part of the "full" template to give me the method for linking directly to the file's URL too

Many thanks

I think the answer is usually a template!

André R.

Thursday 31 May 2007 6:05:24 am

yes:)
And you are correct about the link code from the full template!

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

Mark Emms

Tuesday 05 June 2007 5:25:30 am

OK - I understand all that.

This is what I've done:

1. Created a folder
2. Added some text and then used the insert object dialog
3. Browsed for the object
4. Filled in other required fields

I've overridden base\override\templates\embed\file.tpl

with

{attribute_view_gui attribute=$node.data_map.file icon_title=$node.name}

and now I get no output.

Ideas?

Mark Emms

Tuesday 05 June 2007 5:29:08 am

This always happens to me! I ask a question and then the answer becomes obvious!

Next time I'll read the code before I post!

{let attribute=$object.data_map.file}
{section show=$attribute.content}
<a href={concat("content/download/",$attribute.contentobject_id,"/",$attribute.id,"/file/",$attribute.content.original_filename)|ezurl}>{$attribute.content.original_filename|wash(xhtml)}</a>
{/section}
{/let}