RE: [PHP] RSS / eregi_replace()
| From: | Richard Bewley | Date: | Wed, 04 Aug 2004 01:26:32 +0000 |
| Subject: | RE: [PHP] RSS / eregi_replace() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192647@lists.php.net to get a copy of this message | ||
* Thus wrote Anthony Ritter:
> Greetings,
>
> I'm using an RSS feed from the New York Times and right now the a href
link
> takes the user to the same window.
>
> I'd like the link to open in it's own window by using the target .html
> attribute.
>
> I was hoping that I could use the eregi_replace() call by inserting:
>
> <a
> href="http://\\0">target="_blank">\\0</a>
>
> where it matches any character between the <link></link> string in the
URL.
Hi,
I'm not sure what format the url's are in, but here are a few pieces of
code you can try.
Format: <a href="http://www.news.com/article.php?aid=4">News
Article</a>
<?php
$articleurl = "<a href=\"http://www.news.com/article.php?aid=4\">News
Article</a>";
$broken = explode("\">", $articleurl);
$modified_url = "$broken[0]\" target=\"_blank\">$broken[1]";
Result: <a href="http://www.news.com/article.php?aid=4"
target="_blank">News
Article</a>
-----------------------------------------------------------------
Thank you,
Richard Bewley
rbewley@eq-sys.com
Equinox Systems and Development
Website: http://www.eq-dev.com/
Also, please look at our webhosting services, specializing in business web
hosting starting from $15 per month!