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 />

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 31 2025 05:59:57
Script start
Timing: Jan 31 2025 05:59:57
Module start 'layout'
Timing: Jan 31 2025 05:59:57
Module start 'content'
Timing: Jan 31 2025 05:59:57
Module end 'content'
Timing: Jan 31 2025 05:59:57
Script end

Main resources:

Total runtime0.0148 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.2656151.2266
Module start 'layout' 0.00530.0021 739.492236.6953
Module start 'content' 0.00740.0060 776.187598.1875
Module end 'content' 0.01340.0013 874.375041.9922
Script end 0.0148  916.3672 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002315.7624140.0002
Check MTime0.00117.2931140.0001
Mysql Total
Database connection0.00095.751010.0009
Mysqli_queries0.002114.159130.0007
Looping result0.00000.059610.0000
Template Total0.00106.910.0010
Template load0.00085.378810.0008
Template processing0.00021.506610.0002
Override
Cache load0.00063.865710.0006
General
dbfile0.002617.834680.0003
String conversion0.00000.040340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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