Page 1 of 1

the include function

Posted: Sat Nov 19, 2011 11:59 am
by congos
im new to php and i am trying to make a simple website i.e html dynamic pages with php
everything was ok but after i divided my code into parts and put them in he includes folder on my pc
but when i start index.php i started seeing this below on my web browser ,the orignal code is below(undivided code) am i missing something?

Code: Select all

<?php

include ("includes/header.html");
include ("includes/home.html");
include ("includes/navbar.html");
include ("includes/footer.html");
?>
orignal code

Code: Select all

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/main.css" rel="stylesheet">
<title>My testing website</title>
</head>

<body>
<div class='wrapper'>

<div class='header'></div>
<div class='navbar'>

<div class='button'><a href='index.php?page='>Home</a></div>
<div class='button'><a href='index.php?page=gallery'>Gallery</a></div>
<div class='button'><a href='index.php?page=design'>Design</a></div>
<div class='button'><a href='index.php?page=contacts'>Contacts</a></div>
<div class='button'><a href='index.php?page=about'>About</a></div>
</div>
<div class='mainbody'></div>
div class='footer'>elginin</div>
</div>
</body>
</html>

Re: the include function

Posted: Sat Nov 19, 2011 12:10 pm
by twinedev
So you are actually seeing the source code for PHP when you browse to index.php?

If this is the case, then your server is not set up to parse php files.

-Greg

Re: the include function

Posted: Sat Nov 19, 2011 12:33 pm
by califdon
Expanding on what Greg said, your web server must be configured to process PHP. Is this web server on your local computer or are you hosting this web page on a remote hosting service? If it's a hosting service, then your provider apparently doesn't support PHP, so you need to talk to their Tech Support. If it's on your local computer and you are running Apache web server, you need to download the PHP libraries and then configure Apache by adding a few lines in httpd.conf file; if you are running a Windows web server, you need to follow directions for installing PHP with that server.