We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New Plug-in: Link Target

Development and Programming

Nathan Pitman's avatar
Nathan Pitman
531 posts
17 years ago
Nathan Pitman's avatar Nathan Pitman

Not sure how useful this one will be to others out there but we’re using it here at Nine Four on the Wired In website to link from an IFrame back to the parent window. This is something you would usually achieve with:

<a href="http://www.nathanpitman.com" target="_top" rel="noopener">My Link Text</a>

…but that’s not valid XHTML so instead we need to do:

<a href="http://www.nathanpitman.com">My Link Text</a>

The ‘Link Target’ plug-in just helps to keep your template code clean by writing all the JavaScript for you. Typical usage of the plug-in is as follows:

{exp:np_linktarget url="http://www.nathanpitman.com" target='top'}My Link Text{/exp:np_linktarget}

By default you have to specify a ‘url’ and ‘target’ parameter and the plug-in also optionally accepts a link ‘title’ and ‘class’. Possible ‘type’ values are ‘top’ and ‘blank’. Each mimic the link target attributes ‘_top’ and ‘_blank’ respectively.

Download: pi.np_linktarget.php.zip

Obviously let me know in the comments if you have any thoughts on how this can be improved. Enjoy!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.