Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
v0.2
About It:
Get it:
Rate it:
  • Helpful?
  • 2 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

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:
07 Oct 2007
Article modified:
08 Oct 2007

If there is a comment form at the Information URL, you may want to leave your comments/questions there for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Commented (1)

Cool plug. Unfortunately the old zem_prblock had this feature enabled enclosing a body tag for instance, but doesn;t work anymore since txp 4.0.8 at least. So this one here seems to be the only workaround yet possible.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern