Jump to content

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

Edited by Christian F.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.