Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-04 12:12:18

mttw
Member
From: The Netherlands
Registered: 2005-03-12
Posts: 26

[textile] target= _blank

is it possible to use “target= _blank” with textile?

Offline

#2 2007-08-04 12:34:08

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: [textile] target= _blank

It seems that not :( I think there are plugins that have such functionality


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2007-08-04 14:24:28

mttw
Member
From: The Netherlands
Registered: 2005-03-12
Posts: 26

Re: [textile] target= _blank

unfortunately I can’t find any plugin…. is there somebody who did?

Offline

#4 2007-08-04 19:14:36

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: [textile] target= _blank

Try to look for wet_link


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#5 2007-08-04 20:36:29

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: [textile] target= _blank

Or use zem_prblock.

Offline

#6 2007-08-19 17:30:27

ardilla
Member
From: California, USA
Registered: 2007-06-09
Posts: 11
Website

Re: [textile] target= _blank

Force-opening new windows for non-technical (by technical I mean stuff like the textile help popup) is not a good practice. Nevertheless, you can insert a class like “newwin” and then use JavaScript to insert new window functions. (The target attribute has been deprecated in strict XHTML versions; it should only be used for frames… and when was the last time any of us saw one?)

Offline

#7 2007-08-19 22:56:41

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

Re: [textile] target= _blank

This works

I really wish it was in the Textile core, pleeeaassseee!!!

It’s the only solution I’ve found that would enable me to run smd_slimbox and have links that open externally, in the same article.

wet_link worked, but I really like the Textile link syntax; and zem_prblock would only allow one “REL” attribute in a page.

Last edited by keith (2007-08-19 23:01:35)


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#8 2007-09-12 23:44:46

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: [textile] target= _blank

i tried using this technique but it didnt seem to work. maybe it will work on all future articles i write with textile? but i cant seem to get it to apply to one i just wrote today.

Offline

#9 2010-02-07 12:40:14

hans maulwurf
New Member
Registered: 2010-01-21
Posts: 4

Re: [textile] target= _blank

You can also use raw HTML, seems to be the easiest way to me:

“==<a href=http://panopticlick.eff.org target=”_blank”>EFF’s Panopticlick</a>==”

(remove the “” )

Edit: Does not work with “” around the url after href=

Last edited by hans maulwurf (2010-02-07 12:46:04)

Offline

#10 2010-02-08 10:32:45

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: [textile] target= _blank

I really wish it was in the Textile core, pleeeaassseee!!!

Hope not! The target attribute is deprecated. It was introduced for navigating in frames and frameset and using in non-frameset sites are a misuse.

But if you want really force a new browser window I recommend a jQuery or other Javascript solution with target.

In the <head>:

<script type="text/javascript" src="<txp:site_url />textpattern/jquery.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
	$(document).ready(function() {
		$('.external').attr('target', '_blank');
	});
/* ]]> */
</script>

The only thing you have to do is gving the link the class »external«

Textile:

"(external) link to example.com":http://example.com/

Last edited by trenc (2010-02-08 10:34:39)


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#11 2010-02-08 20:16:55

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

Re: [textile] target= _blank

trenc wrote:


Hope not! The target attribute is deprecated.

Have another look at what I linked to, Tommy – it doesn’t use “Target”, it uses the “Rel” attribute.

That said, your solution looks very neat and straightforward – can we have that in the core instead?

;0)

Incidentally, I wrote the post above 2 1/2 years ago – I think it’s safe to assume that the solution I linked to ain’t going into the core..!

Last edited by keith (2010-02-08 20:26:18)


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#12 2010-02-09 10:00:58

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: [textile] target= _blank

Oh…
I’ve totally overseen this, sorry Keith! :(

Using the rel attribute is a much better option, than creating a deprecated target attribute with javascript.


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#13 2010-12-02 00:32:22

radneck
Plugin Author
Registered: 2005-07-03
Posts: 109

Re: [textile] target= _blank

All these JavaScript and jQuery solutions still effectively add the target=”_blank” attribute to your links – it’s the same as putting it directly in your links in the first place, but with the added (but admittedly negligible) overhead of the browser executing the JavaScript.

While your code may validate with the JavaScript/jQuery solution, this doesn’t mean anything – you’re still adding a deprecated attribute to your hyperlink tags – have a look at the generated source code using FireBug or Web Developer and you’ll see.

The only advantage of this method is not having to hack up Textpattern/Textile.

If you really want to stick to best practices or stick strictly to XHTML 1.0/1.1, don’t push any links into new windows at all – JS or no JS. Its also worth noting that XHTML 1.2 may well have allowed the target attribute (before XHTML 2’s death), and HTML5 doesn’t mind the target attribute.

My advice? Just use common sense – sometimes a _target=”_blank” isn’t such a bad thing.

Offline

#14 2011-01-21 02:05:29

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: [textile] target= _blank

keith wrote:

Have another look at what I linked to, Tommy – it doesn’t use “Target”, it uses the “Rel” attribute.

That said, your solution looks very neat and straightforward – can we have that in the core instead?

;0)

Incidentally, I wrote the post above 2 1/2 years ago – I think it’s safe to assume that the solution I linked to ain’t going into the core..!

Textile rel-attribute support is a feature-candidate for textile core and has been so for a while.

Here’s how to try this out…

  • Install a test copy of textpattern on a localhost site.
  • Download the feature-rel-attributes branch zip
  • Open the zip and over-write your textpattern installation’s classTextile.php with the one from the zip
  • Try out rel-attributes!

Examples…

Textile Output
"linktext(title){rel}":url <a href="url" title="title" rel="rel" >linktext</a>
"linktext(title){!}":url <a href="url" title="title" rel="nofollow" >linktext</a>
"!imageurl(alt text)!(title){rel}":linkurl <a href="linkurl" title="title" rel="rel"><img src="imageurl" /></a>
"(class#id)[en-gb]{text-transform:uppercase}Try this link(Link title){!}":http://textile.sitemonks.com <p><a href="http://textile.sitemonks.com" style="text-transform:uppercase;" class="class" lang="en-gb" id="id" title="Link title" rel="nofollow">Try this link</a></p>

I await feedback on the github issue tracker or in this thread please.


Steve

Offline

#15 2011-01-21 19:48:24

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

Re: [textile] target= _blank

I’m very keen to test this Steve – but I’ve got a horrible feeling that there’ll eventually be a backwards compatability issue with the many pages I’ve already got on my live site that use the hack I mention up the page.

I need to get my head around that a bit… but thank you!


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

Board footer

Powered by FluxBB