Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-05 12:40:15

fonografist
New Member
Registered: 2009-02-02
Posts: 9

eh, open links in new window (target="blank")

Well, this is a bit akward, but i can’t find any way of making links open up in new windows (that is, adding target=“blank” to a <a> tag).
Of course i don’t want all links to open in new windows, that would destroy the internal navigation (obviously), but I have a page with lists of links from the “links” in textpattern. I want those to open in new windows. Then i would like links that I put into the text of an article (with * and : that is) to open in new windows..

Offline

#2 2009-02-05 13:03:44

cnolle
Archived Plugin Author
Registered: 2004-03-21
Posts: 87
Website

Re: eh, open links in new window (target="blank")

Hey,

Make a link form which looks something like this:

<a href="<txp:link_url />" target="_blank"><txp:link_name escape="html" /></a>

— Christian

Last edited by cnolle (2009-02-05 13:04:38)

Offline

#3 2009-02-05 17:37:42

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: eh, open links in new window (target="blank")

Just remember that target is not valid XHTML.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#4 2009-02-05 19:46:03

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: eh, open links in new window (target="blank")

In the head section of your page:

<script type="text/javascript" src="/textpattern/jquery.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('a.external').click(function() {
			window.open(this.href);
			return false;
		}
		);
	});
</script>

In your link form something like this:

<a class="external" href="<txp:link_url />"><txp:link_name escape="html" /></a>

Offline

#5 2009-02-06 04:55:01

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: eh, open links in new window (target="blank")

You could always give adi_link a go.

Offline

Board footer

Powered by FluxBB