How to open all links in new windows/content rewriter plugin

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Sam
Posts: 2
Joined: Tue Jun 08, 2004 4:37 pm

How to open all links in new windows/content rewriter plugin

Post by Sam »

Hello,

I just do not know how to enable the content rewriter plugin to rewrite all links which look like
<a href="http://url">Click me!</a>
to
<a href="http://url" target="_blank">Click me!</a>
Does anybody know how to?
PAINED.NET - 600+ million people could help to create a brand new tomorrow. Now.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: How to open all links in new windows/content rewriter pl

Post by garvinhicking »

Hi Sam!

That wouldn't work with the content rewrite; it is used with fixed string replacement, what you are looking for would need to match regular expressions.

I instead suggest you to look at the 'trackexits' event plugin, this one already rewrites URL. You could adapt it to not encode the exit link, and instead pass the original link through and just expand it to include the 'target' attribute.

Regards,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Sam
Posts: 2
Joined: Tue Jun 08, 2004 4:37 pm

Re: How to open all links in new windows/content rewriter pl

Post by Sam »

garvinhicking wrote: I instead suggest you to look at the 'trackexits' event plugin, this one already rewrites URL. You could adapt it to not encode the exit link, and instead pass the original link through and just expand it to include the 'target' attribute.
I'm using this plugin already, so it wasn't a big problem to include the 'target="_blank"' in _encodeExitsCallback. Thanks!
PAINED.NET - 600+ million people could help to create a brand new tomorrow. Now.
Post Reply