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}

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 15:14:10
Script start
Timing: Jan 18 2025 15:14:10
Module start 'layout'
Timing: Jan 18 2025 15:14:10
Module start 'content'
Timing: Jan 18 2025 15:14:11
Module end 'content'
Timing: Jan 18 2025 15:14:11
Script end

Main resources:

Total runtime1.0887 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.0469152.6250
Module start 'layout' 0.00550.0025 741.671939.4453
Module start 'content' 0.00801.0786 781.1172582.0078
Module end 'content' 1.08660.0021 1,363.125016.1641
Script end 1.0887  1,379.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.3091160.0002
Check MTime0.00140.1247160.0001
Mysql Total
Database connection0.00080.071210.0008
Mysqli_queries1.008392.6137660.0153
Looping result0.00090.0826640.0000
Template Total1.047096.220.5235
Template load0.00260.237920.0013
Template processing1.044495.930620.5222
Template load and register function0.00020.019810.0002
states
state_id_array0.00130.117610.0013
state_identifier_array0.00120.113420.0006
Override
Cache load0.00220.2046390.0001
Sytem overhead
Fetch class attribute can translate value0.00070.066620.0004
Fetch class attribute name0.00250.225780.0003
XML
Image XML parsing0.00300.271820.0015
class_abstraction
Instantiating content class attribute0.00000.0041120.0000
General
dbfile0.00310.2874230.0001
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
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 25
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs