简体   繁体   中英

Linking multiple pages to single index.php page using PHP 'Include'

Im just practicing some things in PHP and have come across a problem.

I am linking multiple pages to single index.php page using PHP 'Include' function ( as i have read it makes a large site much more manageable and easily up-dateable'.

I have created external CSS files (3 in total, one for the navigation, page styling and wrapper content) and have a few external JS files which have all been linked to a PHP document named head.php. (below is the head.php contents)

The main page which the server will show first will be 'index.php' so for this page i am linking all the other segments which will all fit together to create the single page. (below is the index.php contents)

My problem is that in-between both the head and footer php include lines i have created a div named 'wrapper' (styles are already applied to an external CSS sheet named 'style.css' which is linked in head.php) (please see bottom for style.css contents) I would presume that when i view index.php in my browser (i am using XAMPP) that is should show the wrapper on the page, however i can not see the wrapper and i just continue to see the navigation bar only, i find this strange as i can use <h1> and <p> tags in index.php which are externally styled by the php included head.php page.

Please take a look at my code below for all the pages mentioned, I'm not sure what i am doing wrong here. Thank you

BELOW IS HEAD.PHP:

<!DOCTYPE HTML>
<HTML>
<HEAD>

<link rel="stylesheet" type="text/css" href="css/navigation.css">
<link rel="stylesheet" type="text/css" href="css/sitestyle.css">
<link rel="stylesheet" type="text/css" href="css/style.css">

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js">    </script>  
<script type="text/javascript" src="responsee.js"></script>
<link rel="stylesheet" type="text/css" href="engine1//style.css" media="screen" />
<script type="text/javascript" src="engine1//jquery.js"></script>
<script type="text/javascript" src="drop.js"></script>
<script type="text/javascript" src="https://apis.google.com/js/platform.js"></script>

<title>MC SMM | Home</title>

</HEAD>

BELOW IS STYLE.CSS:

#wrapepr {
background-color:black;
width:1000px;
height:1000px;
margin:0 auto;
}

BELOW IS INDEX.PHP:

<?php include('segments/head.php'); ?>

<?php include('segments/facebookjs.php'); ?>

<?php include('segments/homenav.php'); ?>


<div id="wrapper"></div>



<?php include('segments/headbottom.php'); ?>

You have miss spelt your wrapper ID name in your stylesheet:

"#wrapepr"

Should become:

#wrapper

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM