tiddy Posted March 12, 2006 Share Posted March 12, 2006 Hi,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:[i]<a href="somepage.html">[/i]which I want to replace with:[i]<a href="thispage.php?page=www.domain.com/somepage.html">[/i]and I want to replace:[i]<a href="www.domain.com/somepage.html">[/i]with:[i]<a href="thispage.php?page=www.domain.com/somepage.html">[/i]How do I do this without getting:[i]<a href="thispage.php?page=www.domain.comwww.domain.com/somepage.html">[/i]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. Quote Link to comment https://forums.phpfreaks.com/topic/4774-how-annoying-is-str_replace/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.