Reputation: 19
Looking for a way to add a line break in between the text in TD. Which is always different. I'm guessing the detecting factor would be the space between.
<tr class="garment">
<td>Garment:</td>
<td>gildan white 4s basic red 10m</td>
</tr>
This would be the result im looking for
<td>Garment:</td>
<td>gildan<br>white<br>4s<br><br>basic<br>red<br>10m</td>
</tr>
This is the code in my PHP if that helps at all. Thanks!
<tr class="' . ($counter++ % 2 ? "odd" : "even") . '">
<td>Garment:</td>
<td>' . $result['garment_type'] . '</td>
</tr>
Desired code after BR splits
<tr class="garment">
<td>Type:</td>
<td>gildan<br>white<br>4s<br></td>
</tr>
<tr class="garment">
<td>Type:</td>
<td>basic<br>red<br>10m<br></td>
</tr>
Upvotes: 0
Views: 2780
Reputation: 207901
Change:
<td>' . $result['garment_type'] . '</td>
to
<td>' . str_replace(' ', '<br />', $result['garment_type'] ) . '</td>
This will generate the following HTML:
<td>gildan<br>white<br>4s<br><br>basic<br>red<br>10m</td>
Upvotes: 3