Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
v0.2
About It:
Get it:
Rate it:
  • Helpful?
  • 2 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

jra_ext_link

This plugin is a hack to get around the fact that Textpattern doesn’t have a native way to create links with a target=”_blank”. There has been a lot of talk about why it’s not XHTML this- or that-compatible, but, frankly my dear, ... who cares! If I want such a link because it makes my page more usable, I should be able to do it without fuss, and without client-side Javascript dependencies.

To use it, wrap the region where you want the behaviour in the plugin tag. In the region, all links that have the user-defined class will have target="_blank" added to them. The default class is "_", but you can override this using the tag’s class=”“ attribute.

Suggested usage: In the page(s), I wrap the insides of <body> with the tag and use textile link class to define links. Note the friendly link/class notation "(class)text":url doesn’t seem to be available until Txp 4.0.5.

Example 1 (Simple):

<txp:jra_ext_link>
...
This would be an "(_)external link":http://www.elsewhere.com.
...
</txp:jra_ext_link>

yields:

<p>This would be an <a href="http://www.elsewhere.com" target="_blank" class="_">external link</a>.</p>

Note how the class tag remains in the output HTML.

Example 2 (custom class):

<txp:jra_ext_link class="bob" >
...
This is an "(bob)external link":http://www.elsewhere.com.
...
</txp:jra_ext_link>

yields:

<p>This is an <a href="http://www.elsewhere.com" target="_blank" class="bob">external link</a>.</p>

Article Request Count:
Initially released:
07-oct-2007
Posted here:
08 Oct 2007

You know you want to visit the Archives.
Published with Textpattern