Web Design for Beginners

Free top tips for web designers



What makes a PHP file a PHP files?

By James Middleton - Added 29th of August 2008

First things first


To create your first php page, you must firstly ensure that the server that you are uploading the file to, is capable to handle such a file extension. You could either get in touch with your server provider or just continue with this tutorial in hope that all is good.


The PHP file format


Any file you create to hold PHP must be saved with the .php extension. With out this, your server won't know how to deal with the page and the data within it will not be 'parse' or engaged in the correct manner. There are methods out there that can fool force the server to treat any file extension as a PHP or any other format. This will envolve the use of an .htaccess file (not covered in this tutorial).


Getting your .php file ready to hold PHP


Now that you have created your PHP file, you will need to make a distinction between standard HTML, CSS or JavaScript by 'tagging' the portions of the page that will need to be 'parsed'.


Example:


<?php ...your code... ?>

Trying it out


Add the following to your php file and copy it over to the server.


<?php

echo "Hello <b>world!</b><br>";

?>

This is <b>standard</b> HTML



Credits & Links

Article written by James Middleton - www.webdesign-4-beginners.co.uk.

Information for Publishers

You are free to republish this article, provided you retain all hyperlinks as active in the above credits.

Add your own comments

* Must complete
*
*
Please do not use HTML codes within this field

(Max chars: 1000)
Characters remaining:
*
Please type the above code into the box below
(case sensitive):

Please Note: All comments are reviewed before going live.



Web Design for Beginners is ©Copyright 2008 Turning Turnip Web Design - All rights reserved.

Warning: mysql_close(): no MySQL-Link resource supplied in /homepages/38/d234135144/htdocs/webdesign-4-beginners/inc/bot-half.php on line 19