Sulman Posted May 2, 2008 Share Posted May 2, 2008 Hi, I'm looking for some advice really. I have a search page and I am currently doing a string replace on the results to replace the search term so that it is highlighted (replaces "Search Term" with "<span class="highlight">Search Term</span>"). The problem I'm having is if the search term is within a a href tag it messes up my links. Any ideas on how I could solve this? Thanks! Link to comment https://forums.phpfreaks.com/topic/103843-ensuure-str_ireplace-ignores-text-in-a-tag/ Share on other sites More sharing options...
Rohan Shenoy Posted May 2, 2008 Share Posted May 2, 2008 Use the strip_tags() functions. Link to comment https://forums.phpfreaks.com/topic/103843-ensuure-str_ireplace-ignores-text-in-a-tag/#findComment-531600 Share on other sites More sharing options...
Sulman Posted May 2, 2008 Author Share Posted May 2, 2008 Use the strip_tags() functions. Umm...thanks for your reply but I don't think that will work for me. I need to keep the links intact. Just replace the word if it doesn't appear in a link. Thanks Link to comment https://forums.phpfreaks.com/topic/103843-ensuure-str_ireplace-ignores-text-in-a-tag/#findComment-531605 Share on other sites More sharing options...
effigy Posted May 2, 2008 Share Posted May 2, 2008 http://www.phpfreaks.com/forums/index.php/topic,122857.0.html Link to comment https://forums.phpfreaks.com/topic/103843-ensuure-str_ireplace-ignores-text-in-a-tag/#findComment-531722 Share on other sites More sharing options...
Sulman Posted May 2, 2008 Author Share Posted May 2, 2008 http://www.phpfreaks.com/forums/index.php/topic,122857.0.html Excellent. Thanks for pointing me there. Link to comment https://forums.phpfreaks.com/topic/103843-ensuure-str_ireplace-ignores-text-in-a-tag/#findComment-531782 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.