Open PDF directly in a new browser window from link in OE

Author Message

Siw Helen Thorslund

Wednesday 26 April 2006 1:19:24 pm

Maybe this is a stupid question, but I just can't remember how to open a PDF directly in a new browser window from link in Online Editor.

I'm using this code:

Read the <link href='ezobject://373' target='_blank'>PDF</link> here.

Any idea how to get this to work?

I do not want to open the full view of PDF, but the direct link to the file...

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Łukasz Serwatka

Wednesday 26 April 2006 11:22:32 pm

Hi Siw,

You will need to use content/pdf/<node_id> and generate PDF file on the fly.

Read the <link href='content/pdf/<node_id>' target='_blank'>PDF</link> here.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Siw Helen Thorslund

Thursday 27 April 2006 1:50:31 am

I do not want that article as an pdf, but I want the link to a certain pdf uploaded in the media gallery. The link to where it is located in the var directory. How to do this as easy for the user as possible?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Vicente Olivan

Thursday 27 April 2006 2:29:31 am

It would have to work.

Test also:

 

Read the <link href='eznode://373' target='_blank'>PDF</link> here. 
 

Regadrs

Łukasz Serwatka

Thursday 27 April 2006 2:30:40 am

User can use /content/download/2241/22891 instead of /content/download/2241/22891/version/1/file/file.pdf. So basically have to remember object_id and attribute_id. With ezobject and eznode you can link to object/node not to attribute of object. There is no easy way to do this. Furthermore uploaded files are renamed (ezbinaryfile) e.g var/plain/storage/original/application/0dd976dd601a968d7dda515340dc5939.pdf all information are in database and eZ publish download module hadle it.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Siw Helen Thorslund

Thursday 27 April 2006 12:30:38 pm

That works, but is not a very good solution for the users.
But I guess I have to do it this way for now...

What about having it to open directly in the browser window?
Not for download like the code in the example; /content/download/2241/22891.

I tried; /content/view/full/2241/22891, but no luck.

(Still the problem is within Online Editor)

Any suggestions?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Siw Helen Thorslund

Wednesday 31 May 2006 5:34:09 pm

This is still not a very good solution for the users.

I have tried something like:

{section show=$href|contains("pdf")}

	PDF <a href={$href|ezroot()}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>

{section-else}

	OTHER <a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>

{/section}

I need for the PDF to direct to it's filepath to directly open it, and not end up with linking to the full view of the object.

In ezxhtmlxmloutput.php handler, I can see only 'href', 'target', 'classification', 'title', 'content', and 'id' ... which are of no use.

Anyone with a good idea how to solve this?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Heiner Wurbs

Tuesday 29 August 2006 3:13:41 am

This is a solution, not perfect, but it works

{section show=$href|contains("pdfdownloads")} 
	{def $my_node=fetch( 'content', 'node', hash( 'node_path', $href ) )}
	{*again a condition, to be sure, it is a pdf file*}
	
	{section show=$my_node.object.data_map.file.content.original_filename|ends_with( '.pdf' )}
		<a href=/content/download/{$my_node.object.data_map.file.contentobject_id}/{$my_node.object.data_map.file.id}/file/{$my_node.object.data_map.file.content.original_filename }>{$content|wash( xhtml )}</a>
	{section-else}
		<a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>
	{/section}
{section-else}
	<a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>
{/section}

it fetches the node by the $href, which is my case sth like media/pdfdownloads/myfiles/mypdf.pdf

To be sure, that it is a pdf, I added an ends_with condition.

Greetings
Heiner

PS: this is definitiv more comfortable for users than an object relation. The user can simply add a link on any text or object and search for a node or object

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 21 2025 20:12:06
Script start
Timing: Jan 21 2025 20:12:06
Module start 'layout'
Timing: Jan 21 2025 20:12:06
Module start 'content'
Timing: Jan 21 2025 20:12:06
Module end 'content'
Timing: Jan 21 2025 20:12:06
Script end

Main resources:

Total runtime0.0196 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.0065 588.1719151.2422
Module start 'layout' 0.00650.0028 739.414136.7109
Module start 'content' 0.00940.0083 776.1250102.3438
Module end 'content' 0.01770.0018 878.468845.9922
Script end 0.0195  924.4609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002613.1225140.0002
Check MTime0.00125.8966140.0001
Mysql Total
Database connection0.00083.855210.0008
Mysqli_queries0.003618.533430.0012
Looping result0.00000.082810.0000
Template Total0.00136.710.0013
Template load0.00094.732910.0009
Template processing0.00041.909910.0004
Override
Cache load0.00073.425510.0007
General
dbfile0.003116.000280.0004
String conversion0.00000.049940.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