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.