View Full Version : PHP Layout


Xiphias
04-21-2003, 09:20 PM
ok, if you code the layout in PHP, would you need to save the file as .php or .html? I know I'm stupid but I can't help it. And should the coding be something like this, or am I all wrong? If I am wrong, please give me a correct example...


<html>
<head>
<title>TITLE</title>
</head>
<body>
<?
print ("This is where all my \"codes\" go, right?" \n);
?>
</body>
</html>


and would it be better to use the echo or print command for stylish webpages?

pb&j
04-22-2003, 12:00 AM
your pages should have the extension of php or php3 depending on what your host server specifies. (usually just php would do). some servers will also parse html extensions as php, but that is usually a strain on resources.

as for your coding example... mostly correct...
print ("This is where all my \"codes\" go, right? \n");

print and echo are commands used to output information to the visitors screen (on the web page). both do the same job, so it usually comes down to a matter of personal preference on which one you like to use. there is a slight difference between print and echo which would depend on how you want to use the outcome. Using the print method can return a true/false value. this may be helpful during a script execution of somesort. echo does not return a value, but has been considered as a faster executed command.

some resources will state that the quoted areas should be within rounded brackets. this is a valid way of coding, but not required.

Xiphias
04-22-2003, 08:32 PM
Thanks! Most helpful!

Xiphias
05-06-2003, 08:44 PM
is it true that when you upload a php file you view the source and none of the PHP coding is shown?

Dude128
05-07-2003, 03:48 AM
yes, as long as PHP is working properly on the server, the PHP code will be parsed prior to being sent to the browser, so only the HTML code produced will be visible.

Xiphias
05-07-2003, 11:33 AM
thnx... that means I could do my whole layout in PHP and never have a bit of it stolen! :stickout: