Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-13 05:34:57

palmer
Member
Registered: 2006-04-13
Posts: 11

PDF View rather than PDF Download

I’m setting up a TextPattern site that will have occasional newsletter postings in PDF format. I want the files to be uploaded through TXP’s file system and displayed with the <txp:file_download_list category=“x” break=“li” wraptag=“ul” sort=“id desc” /> command. This works wonderfully with one exception. The PDF’s are automatically downloaded (Open / Save Prompt Screen) rather than opened and viewed within the browser.

Is there a way to accomplish this? If so, is there a way to make these PDF’s be viewed in a new window / tab?

Thanks much all.

E

Offline

#2 2006-04-13 07:35:02

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: PDF View rather than PDF Download

You can do that with a file form like this:

<a href="<txp:site_url />files/<txp:file_download_name />" title="<txp:file_download_description />"><txp:file_download_name /></a>

I wouldn’t personally use opening the document in a new window/tab as the default behavior, though. If the user wants to do that, they have the option in the right-click menu (or whatever the similar function is on other OSs). Letting the end-user have the choice is always a good thing.

However, if you want them to open in a new window, just use whatever method you would normally use, like javascript or whatever. I seem to recall there being a plugin or two that opened things up in a new window if you want to search through the plugin forum.

Last edited by whatbrick (2006-04-13 07:36:25)


Do not taunt the Markup Monkey!

Offline

#3 2006-04-13 12:58:05

palmer
Member
Registered: 2006-04-13
Posts: 11

Re: PDF View rather than PDF Download

Wonderful, I guess I had never thought of inserting numerous tags into a string like that.

As for opening in a new window, I can just insert a target=”_blank” into the function you provided.

Thank you.

E

Last edited by palmer (2006-04-13 13:00:58)

Offline

#4 2006-04-13 20:14:09

whatbrick
Member
From: Texas
Registered: 2006-03-13
Posts: 100

Re: PDF View rather than PDF Download

That will work, just keep in mind that your page may not validate depending on the DOCTYPE you use. I know that target="_blank" is not valid in XHTML Strict. I’m not sure about the others as XHTML Strict is all I use. If validation isn’t an issue for you, then don’t sweat it, just wanted to let you know.


Do not taunt the Markup Monkey!

Offline

#5 2006-04-13 21:01:49

palmer
Member
Registered: 2006-04-13
Posts: 11

Re: PDF View rather than PDF Download

Good point on the XHTML Validation. Thanks for the help.

Offline

#6 2006-04-13 23:00:41

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

Re: PDF View rather than PDF Download

I wouldn’t personally use opening the document in a new window/tab as the default behavior, though. If the user wants to do that, they have the option in the right-click menu (or whatever the similar function is on other OSs). Letting the end-user have the choice is always a good thing.

I actually do recommend opening new PDFs or Word docs (for instance) in a new window by default. If you don’t, users will invariably close the PDF or Word Document because they think it’s a separate application.

Offline

Board footer

Powered by FluxBB