Jump to content

Reformatting The Contents Of Table Rows


denhamd2

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/272181-reformatting-the-contents-of-table-rows/
Share on other sites

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. :P

 

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. ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.