Never heard of PHP? You don’t know what you’re missing! Here how to start a site with (or convert a site in) PHP.
What you need:
PHP enabled: you need to be hosted or have a domain on a server which supports PHP, there are some free hosts which offer php but I’ve never tried them.
From HTML to PHP:
If you have already a site in HTML, first you need to change .html at the end of all your pages and write .php. If you’re starting from scratch, lucky you! You don’t need to change anything but create pages with .php at the end, meaning everytime you save a page, save it as .php and not .html or .htm.
Now we have to start dividing our pages: creating header.php, namepage.php and footer.php.
In your header.php you have the head part of your pages, in the namepage.php the content and in the footer.php what you want to appear at the end of every pages. Here an example:
header.php:
<html> <head> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <title>YOUR WEB TITLE</title> <link rel="stylesheet" type="text/css" href="http://YOUR_STYLESHIT_URL.css" /> </head> <body> Your layout coding
Change:
YOUR WEB TITLE: with the title of your website;
YOUR_STYLESHIT_URL.css: with the URL of your style shit or CSS if you have one, please make one it’s easier, believe me;
Your layout coding with your layout coding which is above the main area of your pages (if you keep reading, there’s an example to understand this better).
namepage.php:
<? include('header.php'); ?> <p>Welcome!<br /> Here you'll find etc....</p> <? include('footer.php'); ?>
Here you have to write the content of your pages. So every page has this form with one include at the top (same for every page), the content which changes with every page you write and another include which closes the page. Don’t erase those two includes!
footer.php:
End of your layout coding <p>Ads...</p> <p>Copyright...</p> </body></html>
Here you’ll write the end of the page so the tags: </body></html> and before those whatever you want to appear on every page (for example Google ads, copyright, vote for me buttons, quick links and on). Don’t forget the end of your layout coding which can go above the ads or after (depends on your layout).
I’m going to use this div coding to make this more clear
<html> <head> <!-- Coded with Eien Café http://eiencafe.com/ help --> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <META NAME="Title" CONTENT="YOUR TITLE"> <META NAME="Author" CONTENT="YOU"> <META NAME="Copyright" CONTENT="© YOUR SITE NAME AND YOUR NAME"> <META NAME="Distribution" CONTENT="Global"> <META NAME="Robots" CONTENT="All"> <title>WEBSITE TITLE</title> <!-- Erase if you don't have CSS Beginning--> <link rel="stylesheet" type="text/css" href="URL of your css if you have it or erase this"> <!-- Erase if you don't have CSS end --> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <img style="position:absolute; top:0px; left:0px" src="YOUR IMAGE URL" border="0"> <div id="MENU1" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx"> main menu, navigation </div> <div id="CONTENT" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx"> main page, welcome image, updates and on... </div> <div id="MENU2" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx"> submenu </div> </body></html>
Now we have to divide it in header.php, namepage.php and footer.php:
header.php:
<html> <head> <!-- Coded with Eien Café http://eiencafe.com/ help --> <META HTTP-EQUIV="imagetoolbar" CONTENT="no"> <META NAME="Title" CONTENT="YOUR TITLE"> <META NAME="Author" CONTENT="YOU"> <META NAME="Copyright" CONTENT="© YOUR SITE NAME AND YOUR NAME"> <META NAME="Distribution" CONTENT="Global"> <META NAME="Robots" CONTENT="All"> <title>WEBSITE TITLE</title> <!-- Erase if you don't have CSS Beginning--> <link rel="stylesheet" type="text/css" href="URL of your css if you have it or erase this"> <!-- Erase if you don't have CSS end --> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <img style="position:absolute; top:0px; left:0px" src="YOUR IMAGE URL" border="0"> <div id="MENU1" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx"> main menu, navigation </div> <div id="CONTENT" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx">
namepage.php:
<? include('header.php'); ?> main page, welcome image, updates and on... for the first page and the content of the other pages (for example glitters, graphic... <? include('footer.php'); ?>
footer.php:
</div> <div id="MENU2" style="position: absolute; z-index:2; left: XXXpx; top: YYYpx; width:ZZZpx"> submenu </div> </body></html>
namepage.php will be called index.php as first page (when people write http://yourdomain.com on their browser ) and if you don’t have a splash page this is where there are the updates, blog etc…
it will be whatever else for the other pages ex: in credits.php there will be a list of all the websites that helped you create and design your website (please have one).
Now upload all three pages to your server and test it. That’s all, you have a php page, now you can use namepage.php as a template for all your pages.