Revisiting old code
January 6th, 2010 12:01 pm
At work, I’m fixing an old-ish application. It’s a web app, originally written in 2000, last updated in 2003. It’s amusing to see these old codes.
<tr>
<td align="center" width="50%" nowrap>
<font color="#0000ff" size="3">
<strong>
<a href="summary.php?id=" target="_top">
<?php print $type; ?> Summary
</a>
</strong>
</font>
</td>
<td align="center" width="40%" nowrap>
<font color="#0000ff" size="3">
<?php
if ($type <> "P")
{
?>
<a href="detail.php?id=<?php print $id;?>" target="_top">
<strong><?php print $type; ?> Detail</strong>
</a>
<?php
}
else
{
print "<strong> </strong>\n";
}
?>
</font>
</td>
</tr>
Holy cow, the font tag? Which half of it does not work anyway? (The font color gets overridden by the <a> tag’s default color.) And what’s this line 24? Using PHP’s print tag to print straight HTML code… that’s not so bad. But using <strong> around the . That’s absurd. And too many <font> and <strong> tags and such – those should be handled with CSS, especially because this is a part of a tabular data.
Man, old codes are scary.
Not to mention, the entire PHP code for the whole app was a huge mess.