How to insert echo statements in order to insert RDFa Lite markup

31 Views Asked by At

I have an issue that I can't seem to solve, without breaking the entire page.

I need to edit this following code and insert extra echo statements. The echo statements are needed in order to markup with RDFa Lite.

echo '<td><a href="sportsteam.php?id='.$row['SportsTeam_id'].'">'.$row['name'].'?></a></td>
                                          <td>'.$row['startDate'].'</td>
                                          <td>'.$row['endDate'].'</td>
                                        </tr>';

I need to insert the echo statements before and after $row['name'], $row['startDate'] and $row['endDate'].

2

There are 2 best solutions below

0
chaitanya On

Better add it to a variable and concatenate with '.'

$value = '<td><a href="sportsteam.php?id='.$row['SportsTeam_id'].'">'.$row['name'].'?></a></td>' ;
$value .= '<td>'.$row['startDate'].'</td>';
$value .= '<td>'.$row['endDate'].'</td></tr>';
echo $value;
0
Anuga On

If short_open_tag is activated, always on since PHP 5.4.

<?='<tr>'?>
<?='<td><a href="sportsteam.php?id=' . $row['SportsTeam_id'] . '">' . $row['name'] . '?></a></td>'?>
<?='<td>' . $row['startDate'] . '</td>'?>
<?='<td>' . $row['endDate'] . '</td>'?>
<?='</tr>'?>

Or...

<?php
echo '<tr>';
echo '<td><a href="sportsteam.php?id=' . $row['SportsTeam_id'] . '">' . $row['name'] . '?></a></td>';
echo '<td>' . $row['startDate'] . '</td>';
echo '<td>' . $row['endDate'] . '</td>';
echo '</tr>';
?>