Forums / Setup & design / link directly to a file

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.

eZ debug

Timing: Jan 18 2025 11:17:43
Script start
Timing: Jan 18 2025 11:17:43
Module start 'content'
Timing: Jan 18 2025 11:17:43
Module end 'content'
Timing: Jan 18 2025 11:17:43
Script end

Main resources:

Total runtime0.1579 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.1328180.8438
Module start 'content' 0.00550.0049 769.9766105.9766
Module end 'content' 0.01050.1474 875.9531535.2500
Script end 0.1579  1,411.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.1653200.0002
Check MTime0.00150.9205200.0001
Mysql Total
Database connection0.00080.504010.0008
Mysqli_queries0.115973.38131410.0008
Looping result0.00140.89351390.0000
Template Total0.147193.110.1471
Template load0.00090.563510.0009
Template processing0.146292.555410.1462
Override
Cache load0.00060.395810.0006
Sytem overhead
Fetch class attribute can translate value0.00050.293210.0005
XML
Image XML parsing0.00020.157610.0002
General
dbfile0.00161.0306200.0001
String conversion0.00000.003230.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs