Forums / Setup & design / Directly open related PDF-documents in articles

Directly open related PDF-documents in articles

Author Message

Valentin Svelland

Thursday 25 September 2003 7:18:26 am

Hi guys! I've made an override file for the handling of embedded pdf-documents in articles called : embed_pdf.tpl. As you can see under I use this file to show related PDF-documents as a link followed by an Acrobat-icon.

However, when clicked on, I want this PDF-link to directly return the actual PDF-document. I know where to change the code, but not how to retrieve this url.

--------------
{default attribute_parameters=array()}
<a class="normal2" href={concat('content/view/full/',$object.main_node_id)|ezurl}>{$object.name|wash}</a>
<img src={"ikon_acrobat.gif"|ezimage} width="19" height="9" border="0" />
{/default}
--------------------

The bit after 'href={concat' should return urls like this:
/ez/index.php/admin/content/download/1134/8203/file/somefile.pdf

Anyone? :)

Valentin Svelland

Monday 29 September 2003 3:45:54 am

Surely someone must have faced this "problem"?
:)

Valentin

James Packham

Monday 29 September 2003 3:59:53 am

I've had a similar problem, though I think you're maybe a little bit more advanced than me so this might not help.

When editing your article (the one that you want your link in) look to the right and you'll see "related objects" on the side bar. Click the little magnifying glass and find your object (the pdf file you want to link to), check the box and click select.

You should then be taken back to your article, but now you have your object in the related objects box. Either right click, copy and paste the link (remember to take the "admin" or such like part out of it after you paste!) or use the the object ID to create the link.

I prefer to use the link method, because I'm more familiar with it but the choice is up to you :)

~James~

Valentin Svelland

Monday 29 September 2003 4:17:39 am

Hi James, it's not quite what I'm looking for. I know how to link up objects to my articles, but I want to design an pdf-object which allows users to directly view the pdf-document via my article.

To do this I've overriden embed.tpl with embed_pdf.tpl like this:

{default attribute_parameters=array()}
<a href={concat("content/download/",$attribute.contentobject_id,"/",$attribute.id,"/file/",$attribute.conte
nt.original_filename)|ezurl}>test {$attribute.content.original_filename|wash(xhtml)}</a> {$attribute.content.fil
esize|si(byte)}
<img src={"icon_acrobat.gif"|ezimage} width="19" height="9" border="0" /><br />
{/default}

I've also added this rewrite rule:

RewriteRule ^/content/download.*$ <httproot>/ezpublish-xxx/index.php [L]

Still, the link doesn't lead directly to my pdf-document..

James Packham

Monday 29 September 2003 4:44:31 am

Well I can't help you with the overide templates (like I said you're more advanced than me!) but with the link bit, yeah sorry about that I forgot to add that you have to follow the link it gives you and then copy and paste the link you find to the object.

You should end up with something along the line of http://192.168.0.1/news/content/download/76/204/file/FM.pdf
unless I've already forgotten how to do it ;)

(seriously though if that doesn't work, I laid out the exact procedure in a post last week right after I'd figured it out.)

Valentin Svelland

Monday 29 September 2003 5:18:41 am

Thanks James, that's a way to solve it - but I need an integrated way of doing this through templates..

Valentin Svelland

Monday 29 September 2003 6:44:56 am

This code works for me now (to directly download the related node with pdf-file):

<img src={"ikon_acrobat.gif"|ezimage} width="19" height="9" border="0" /> <a class="normal2" href={concat("content/download/",$object.data_map.fil.contentobject_id,"/",$object.data_map.fil.content.contentobject_attribute_id,"/file/",$object.data_map.fil.original_filename)|ezurl}>{$object.name|wash}{*$object.data_map.fil.content.original_filename|wash(xhtml)*}</a> <span class="normal2">({$object.data_map.fil.content.filesize|si(byte)})</span><br />

eZ debug

Timing: Jan 31 2025 05:05:23
Script start
Timing: Jan 31 2025 05:05:24
Module start 'content'
Timing: Jan 31 2025 05:05:24
Module end 'content'
Timing: Jan 31 2025 05:05:24
Script end

Main resources:

Total runtime0.2786 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.0083 588.0859180.8125
Module start 'content' 0.00830.0081 768.8984101.9297
Module end 'content' 0.01640.2621 870.8281531.3750
Script end 0.2785  1,402.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00361.2750200.0002
Check MTime0.00140.5005200.0001
Mysql Total
Database connection0.00130.458010.0013
Mysqli_queries0.225080.76691410.0016
Looping result0.00140.51221390.0000
Template Total0.261793.910.2617
Template load0.00100.349910.0010
Template processing0.260793.586010.2607
Override
Cache load0.00060.220410.0006
Sytem overhead
Fetch class attribute can translate value0.00060.211110.0006
XML
Image XML parsing0.00040.132810.0004
General
dbfile0.00993.5706200.0005
String conversion0.00000.001430.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.0002 secs