the include function

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
congos
Forum Newbie
Posts: 2
Joined: Sat Nov 19, 2011 11:41 am

the include function

Post 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>
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: the include function

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: the include function

Post 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.
Post Reply