Solarpitch Posted March 26, 2011 Share Posted March 26, 2011 Hey Guys, I'm querying a database that is going to return a html page. In this page I'm going to define content areas with a class. eg: <div class="category"></div> Anywhere I have this class in the html code, I want to dynamically insert a link into it. So when I retrieve the code from the database, I need the code to check for this tag (class="category") and add a standard link (<a href="..">Add new Category</a>) Not 100% sure whats the most efficient way to go about this. Quote Link to comment Share on other sites More sharing options...
Solarpitch Posted March 26, 2011 Author Share Posted March 26, 2011 Thi sworked actually $string = $code; $expression = "</head>"; $insertvalue = " Hello"; $string=preg_replace("|$expression|",$expression.$insertvalue,$string,1); Quote Link to comment 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.