Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-01 20:54:36

sparksmemphis
Member
From: Memphis TN
Registered: 2008-01-23
Posts: 10
Website

Textpattern target blank?

I have a pdf in my files that i want to effectively target blank but im using the textpattern link builder, i dont want to use html.

how would i do this.

actually what i need is to make my pdf show up in a new tab or window instead of download.

answering either question is fine. thanks!!!!!


www.digitalskraps.com

Offline

#2 2008-05-01 21:19:16

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Textpattern target blank?

if it’s on file list then your file form could look:

<a target="_blank" href="<txp:site_url />files/<txp:file_download_name />"><txp:file_download_name /></a>

Or if it’s just link:

<a target="_blank" href="<txp:site_url />files/file.pdf">File.pdf</a>

Or it could be just:

<txp:file_download_link id="x" />

And if we are precise, then you should not use the target attribute, as it’s deprecated and only used with frames. Therefor you should use JS instead that is connected to rel="external".

Offline

#3 2008-05-01 22:42:24

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Textpattern target blank?


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#4 2008-06-17 08:32:03

fastasleep
Member
Registered: 2008-06-17
Posts: 10

Re: Textpattern target blank?

I had to figure out how to do this for a client, and here’s what I ended up changing:

- In textpattern/publish.php: - Line 135: change: header('Content-Disposition: attachment; filename="' . basename($filename) . '"; size = "'.$filesize.'"'); to: header('Content-Disposition: inline; filename="' . basename($filename) . '"; size = "'.$filesize.'"');

- In textpattern/includes/txp_tag.php: - Line 3584 change: $out .= tdb('<a href="'.$url.'"'.$description.'>'.$thing.'</a>'); to: $out .= tdb('<a href="'.$url.'" target="_blank"'.$description.'>'.$thing.'</a>');

First one makes your pdf display in the browser window instead of forcing it to download. Second one tweaks the XHTML Tag Builder in the Files admin page adding target=”_blank” which opens it in a separate window. The first edit is retroactive, but you’ll have to manually go in and replace any existing file download links with the XHTML tag builder link to target a blank page.

Kinda hacky, but it seems to work, so… just in case this saves anyone the hours it took for me to dig through the source code and find this crap. :)

Last edited by fastasleep (2008-06-17 08:38:37)

Offline

#5 2008-06-17 13:12:47

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Textpattern target blank?

Thanks for sharing! :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB