link directly to a file

Author Message

Michael Kress

Monday 24 March 2008 12:17:47 am

Hello, I'm using 3.9.2 but the effect also shows in 4.0 ...
I'd like to link directly to a pdf file that I've put as a child object under a pulicly accessible folder/article named /downloads. There I have many pdf files. It works by inserting an object that displays a little icon which I don't really like. So when I want to link there just with a text link, I can't link directly to the file, there is always a sort of wrapper link in front:
http://www.my.site/content/view/line/510
There, I get then the link to the actual file:
http://www.my site/content/download/640/3346/file/myfile.pdf

But I'd like to link directly to the latter, i.e. directly to the pdf file.
The only way to achieve this is to copy the link from the wrapper page and insert a text link that links there directly and not selected vie the object/node browser.

I hope, I expressed myself comprehensible. If you like to, I can post some screenshots somewhere documenting the actions I did...
TIA
Michael

Daniele Nocentini

Wednesday 26 March 2008 4:56:09 am

Hi!

try to insert this link in your full view template of your class with a ezbinaryfile datatype called "file":

<a href={concat( 'content/download/', $node.data_map.file.contentobject_id, '/', $object.data_map.file.id,'/version/', $node.data_map.file.version , '/file/', $node.data_map.file.content.original_filename|urlencode )|ezurl}>Download</a>

Antica Bottega Digitale srl
http://www.abd.it

Felix Laate

Wednesday 26 March 2008 5:39:19 am

Hi,

or maybe in embed/file.tpl? That's the code that gets embedded when you insert an object in a xml-field.

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Daniele Nocentini

Wednesday 26 March 2008 6:36:11 am

it's the same thing, the embed view is tipically used for show a preview of object instead view embed-inline is used for show only a link to the object but you can choice the view do you prefer and replace code template with only a link for download or with others datatype.

Antica Bottega Digitale srl
http://www.abd.it

John Kazakis

Thursday 27 March 2008 5:46:46 am

I'm using a similar code to the one posted above, but for some reason it doesn't work with spaces.

I have this code

    {if $node.object.data_map.file_version.has_content}
    	<span class="links"><a href={include uri= 'design:d_templates/file_url.tpl' attribute=$node.object.data_map.file_version}>VIP Access</a></span>
    {/if}

File_url.tpl:

{* This template print the url of a file attribute *}
{* Parameters:
        $attribute
*}

{concat("content/download/",$attribute.contentobject_id,"/",$attribute.id,"/file/",$attribute.content.original_filename)|ezurl}

When there's a file with spaces it shows "http://www.mywebsite.com/content/download/92121/511539/file/file%20name.pdf"

It doesn't change the spaces, and because of that I get a 404 module not found page. Is there any way for me to fix this?

I posted a thread about this, but unfortunately nobody seems to know what the issue is...

Felix Laate

Thursday 27 March 2008 6:37:20 am

@John

Are you using Firefox? Or dows this happen in every browser?

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

John Kazakis

Thursday 27 March 2008 8:11:03 am

Hello Felix,

Sorry I forgot to mention that it only happens in Firefox...

I'm using version 2.0.0.13

Stéphane Bullier

Thursday 27 March 2008 12:18:19 pm

Hello,

You can see this article : http://pwet.fr/blog/creating_a_link_to_download_a_file_with_online_editor_in_ez_publish

and this post : http://ez.no/developer/forum/developer/url_encode

Stéphane

Michael Kress

Thursday 27 March 2008 1:04:02 pm

Stéphane, Thanks for the blog link, I followed the steps there but I still got the wrapper page around, i.e. in front, I still have to click another link to get to the file.
Any ideas?
Cheers
Michael

Russell Michell

Wednesday 20 August 2008 9:10:26 pm

Michael, about 5 months too late I know but I had the same issue for images.

My solution (well-easy) would be as good as the same as for your situation.

See: http://ez.no/developer/forum/setup_design/solved_llink_a_thumbnail_image_to_larger_version#msg172802

Good luck :-)
Russ

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

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 16:19:43
Script start
Timing: Jan 18 2025 16:19:43
Module start 'layout'
Timing: Jan 18 2025 16:19:43
Module start 'content'
Timing: Jan 18 2025 16:19:44
Module end 'content'
Timing: Jan 18 2025 16:19:44
Script end

Main resources:

Total runtime0.8256 sec
Peak memory usage4,096.0000 KB
Database Queries86

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 589.0391152.6250
Module start 'layout' 0.00690.0029 741.664139.4453
Module start 'content' 0.00990.8140 781.1094773.5000
Module end 'content' 0.82390.0016 1,554.609420.1719
Script end 0.8255  1,574.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3940160.0002
Check MTime0.00140.1664160.0001
Mysql Total
Database connection0.00100.122810.0010
Mysqli_queries0.742689.9460860.0086
Looping result0.00110.1319840.0000
Template Total0.795696.420.3978
Template load0.00230.274620.0011
Template processing0.793396.095620.3967
Template load and register function0.00020.019610.0002
states
state_id_array0.00080.102210.0008
state_identifier_array0.00100.126120.0005
Override
Cache load0.00200.2369610.0000
Sytem overhead
Fetch class attribute can translate value0.00060.074260.0001
Fetch class attribute name0.00090.1115140.0001
XML
Image XML parsing0.00260.312860.0004
class_abstraction
Instantiating content class attribute0.00000.0038160.0000
General
dbfile0.00140.1717340.0000
String conversion0.00000.001040.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
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs