So I'm making a search function for comments. Someone else here helped me with the SQL query. What I also want to do is to highlight the search query text in the results.
The results are stored as HTML inside a $variable
.
How can I wrap the search query text inside a <span>
tag for example, without messing up the html.
örneğin için. arama sorgusu foo bar
olabilir ve çıkış gibi görünebilir:
<p>bla bla foo bar bla</p>
bu yüzden böyle bir şey olmalı:
<p>bla <span class="highlight">foo bar</span> bla bla</p>