Like my work? If you're looking for a Bracknell Web Design Agency then drop us a line at 'Nine Four' and we can hook up for a chat.

ExpressionEngine Plug-in: Link Target Wednesday July 9, 2008

Not sure how useful this ExpressionEngine Plug-in 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">My Link Text</a>

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

<a href="http://www.nathanpitman.com" onClick="top.location=this.href; return false">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!

Posted in: ExpressionEngine

 
Play online poker at Full Tilt Poker and PokerStars. The best online poker rooms still open to US players. welike-Poker.com provides unbiased and critical online poker room reviews.
Leave your comments
name:
email: Gravatar enabled.
http://
Format your message with Textile.
Remember

related

recently

The 10 most recent articles.