I read posts on this forum, primarily as an inspriation and tutorials (since my knowledege of PHP isn't that great) but I am intriuged by the use of PHP in many cases.
I code/write HTML in such a way that as little as possible is PHP. for example, assuming I have already got the variable set up, I would write:
<b>Welcome <?php echo $_SESSION['user_name'] ; ?> to the forums </b>
where as it seems by reading most post on here, a lot of people would write:
<?php echo "<b>Welcome " . $_SESSION['user_name'] . " to the forums </b>" ; ?>
When I first started PHP, this is what I used to do, since that was the way it is taught in "WROX - Begining PHP4"
and when I am printing out tables that contain (suprise suprise) tabulated data, only the contents of the cell is done in php, for example:
<tr>
<td><?php echo $ID ; ?></td><td><?php echo $variable1 ; ?></td><td> <?php echo $variable2 ;?></td>
</tr>
Is this the best approach? or does this overload the server?
Is there any proof which method is best? or is it just a matter of personal choice?
My thinking was, the less processing the PHP engine had to do, the quicker the server could 'serve' the page.
I have recently started working more with SED & (N)AWK and I am wondering if there is a server overhead going from HTML -> PHP -> HTML -> PHP etc etc?
Steven