denhamd2 Posted December 19, 2012 Share Posted December 19, 2012 Hi, I'm trying to take the content from table rows and reformat it. You can see a sample structure of the HTML below: <table><tr> <td class="fixData" align="right" width="40%">Team 1</td><td class="fixData" align="center" width="10%"> v </td><td class="fixData" align="left" width="40%">Team 2</td> <td class="fixData" align="right" width="10%"><a href="#">Results</a></td> </tr><tr> <td class="fixData" align="right" width="40%">Team 3</td><td class="fixData" align="center" width="10%"> v </td><td class="fixData" align="left" width="40%">Team 4</td> <td class="fixData" align="right" width="10%"><a href="#">Results</a></td> </tr></table> I'm trying to change it to: <tr> <td class="newfixData"><a href="result.php?Team1-Team2">Team 1 v Team 2</a></td> </tr> Any ideas how I could do this? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted December 19, 2012 Share Posted December 19, 2012 search and replace? Quote Link to comment Share on other sites More sharing options...
denhamd2 Posted December 19, 2012 Author Share Posted December 19, 2012 (edited) Hi Sorry I'm a bit of a newb. Would you be able to explain more? Just a little confused, sorry Thanks for your help! Edited December 19, 2012 by denhamd2 Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 19, 2012 Share Posted December 19, 2012 You'll want to use a Dom parser Quote Link to comment Share on other sites More sharing options...
Christian F. Posted December 19, 2012 Share Posted December 19, 2012 (edited) If the HTML code is something you control, then use an editor that can do a "search and replace" operation on the document. As Muddy_Funster so succinctly stated in his post. If you do not control the HTML code, then you'll need DOMducoment or similar. Have it parse the document, find the relevant HTML elements, draw the text you want from them, and then add it to a new string. Just like what Jessica[/]b said, equally succinctly. Edited December 19, 2012 by Christian F. 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.