【问题标题】:Linking multiple pages to single index.php page using PHP 'Include'使用 PHP 'Include' 将多个页面链接到单个 index.php 页面
【发布时间】:2014-08-10 22:27:36
【问题描述】:

我只是在 PHP 中练习一些东西,但遇到了一个问题。

我正在使用 PHP 的“包含”功能将多个页面链接到单个 index.php 页面(正如我所读的那样,它使大型网站更易于管理和更新”。

我创建了外部 CSS 文件(总共 3 个,一个用于导航、页面样式和包装内容),并且有一些外部 JS 文件都已链接到名为 head.php 的 PHP 文档。 (下面是head.php的内容)

服务器将首先显示的主页将是“index.php”,因此对于此页面,我将链接所有其他段,这些段将全部组合在一起以创建单个页面。 (下面是index.php的内容)

我的问题是在页眉和页脚 php 之间包含行我创建了一个名为“wrapper”的 div(样式已应用于名为“style.css”的外部 CSS 表,该表在 head.php 中链接)(请参阅底部的 style.css 内容)我认为当我在浏览器中查看 index.php 时(我正在使用 XAMPP)应该在页面上显示包装器,但是我看不到包装器,我只是继续只看到导航栏,我觉得这很奇怪,因为我可以在 index.php 中使用 <h1><p> 标记,这些标记由 php 包含的 head.php 页面进行外部样式化。

请查看我下面提到的所有页面的代码,我不确定我在这里做错了什么。谢谢

下面是 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>

下面是样式.CSS:

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

下面是 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'); ?>

【问题讨论】:

    标签: javascript php jquery html css


    【解决方案1】:

    您在样式表中没有拼写您的包装器 ID 名称:

    “#wrapepr”

    应该变成:

    #wrapper
    

    【讨论】:

    • 是的!正如你确实给了我一个解决方案,我会做的,非常感谢
    猜你喜欢
    • 2015-06-02
    • 2010-11-18
    • 1970-01-01
    • 2020-05-12
    • 1970-01-01
    • 2013-12-13
    • 2016-01-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多