Code: Select all
echo " </tr>\n";
echo " <tr class=\"td_temperature_data\">\n";
echo " <td>Temperature</td>\n";
echo " <td>$temp $tempunit></td>\n";
echo " <td>Dew Point </td>\n";
echo " <td>$dew $tempunit></td>\n";
echo " </tr>\n";
Moderator: mcrossley
Code: Select all
echo " </tr>\n";
echo " <tr class=\"td_temperature_data\">\n";
echo " <td>Temperature</td>\n";
echo " <td>$temp $tempunit></td>\n";
echo " <td>Dew Point </td>\n";
echo " <td>$dew $tempunit></td>\n";
echo " </tr>\n";
It is not as simple as that. Yes there are 2 approaches (all php or stick to HTML to extent possible). But which is better depends on what your aim is:
Writing mostly in php, getting PHP to write out all the structure has the disadvantage that you can't see that if you use "view source" in your browser.
It is not for me to say which is best for you. Yes, it is marginally more inefficient to enclose in double quotes content that is not variables, so the PHP manual will say your third line above should read to give maximum efficiency for the PHP parser:
Code: Select all
echo "\t" . '<td>' . $temp . ' ' . $tempunit . '</td>' . "\n";Code: Select all
Warning: Invalid argument supplied for foreach() in /home4/markrennie71/public_html/get-USNO-sunmoon.php on line 361
Warning: Invalid argument supplied for foreach() in /home4/markrennie71/public_html/get-USNO-sunmoon.php on line 372