Jump to content


how annoying is str_replace?

  • Please log in to reply
No replies to this topic

#1 tiddy

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 12 March 2006 - 07:29 PM


I'm looking to create something like rinkworks dialectizer (http://www.rinkworks.com/dialect) and i need to replace all the <a href="[relative address]"> with <a href="[thispage]?page=[entire address]"> how can i do this without replacing all the <a href="[entire link]"> with <a href="[thispage]?page=[domain][entire address]">.
For example I have:
<a href="somepage.html">
which I want to replace with:
<a href="thispage.php?page=www.domain.com/somepage.html">
and I want to replace:
<a href="www.domain.com/somepage.html">
<a href="thispage.php?page=www.domain.com/somepage.html">
How do I do this without getting:
<a href="thispage.php?page=www.domain.comwww.domain.com/somepage.html">
I am using str_replace('href="','href="thispage.php?page=' . $page,$pagestr);
where $page is the address and $pagestr is the content of that page.

Thanks for any help.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users