| Languages Used |
|---|
| XHTML PHP |
2. Now you have all the framework from the CSS, or whatever you used for the site. Now you have to decide what elements of the page you will want on every page of the site. In my case I have everything except the main center column, or the main body, in the master page.
3. Start coding the master.php.
CODE BLOCK 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
5. Next is to link to any external files, set up meta data, and add a title to the page. This is where your first line of PHP will come in to play.
CODE BLOCK 2
<head>
<meta name="revisit-after" content="30 days" />
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
<title>Your Domain - <?php echo $pagetitle; ?> </title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
7. You see your first line of PHP code here in the line that starts with title. The ?php tells the server to run this as PHP, echo tells the server to write the contents of the following variable, $pagetitle to the browser window. We must remember the variable name for later, it is how we will link to the actual content.
8. Next we create the framework for the page. I am also using CSS, so there are many div tags here separating my page contents.
CODE BLOCK 3
<body>
10. The next line of code in Code Block 4 is our next line of PHP.
CODE BLOCK 4
<?php echo $pagemaincontent; ?>
CODE BLOCK 5
</body>
</html>
13. In this particular case all we are keeping from page to page is the CSS files, and the basic HTML framework. To see a more advanced page, click here. The advanced version will handle all of your navigation, headers, and footers. The only thing you change from page to page is the main content. 14. Now to see how the content pages are created, click here.
