是否可能在同一个php文件中包含2个html页面? [英] Is it possible to include 2 html pages in the same php file?
问题描述
我有一个 index.php
文件,我试图在其中包括页眉和页脚(html文件)。它们都是基于引导的,我只是在 header.html
中做了一些自定义。如果我只包括头文件没有问题,并且 index.php
显示为expect,但当我包括这两个文件(hearer / footer.html),由于某种原因,我的css不显示更改(只显示引导程序的默认值)。这是我想解决的问题。我也会问另一个问题:
I have an index.php
file and I'm trying to include the header and footer (html files) in it. They are both bootstrap based and I just made a few customizations in header.html
. If I include only the header file there's no problems at all and index.php
is displayed as expect but when I include both files (hearder/footer.html), for some reason, my css doesn't display the changes (only displays the default values of the bootstrap). This is the problem I would like to solve. I will ask another question too:
-
我有几个页面有相同的页眉和页脚。这里的目标不是重复代码。这是更好的方式来包括
这些元素(页眉/页脚)?我做的对吗?
I have several pages that have the same header and footer. The goal here is not repeating code. Is this the better way to include these elements (header/footer)? Am I doing it right?
这些是我使用的文件:
- 此笔显示应显示在index.php文件中的修改。
- 此文件表示主文件(index.php)
- < a href =http://pastebin.com/s64KFqc7 =nofollow>此文件包含header.html
- 此文件包含footer.html
- This pen shows the modifications that should be displayed in the index.php file.
- This file represents the main file (index.php)
- This file contains the header.html
- This file contains the footer.html
我意识到如果我在主文件 index.php $中注释
footer.html
c $ c>它的内容显示,一切正常。
I realized that if I comment the include of footer.html
in the main file index.php
it's content is displayed and everything works right.
推荐答案
实际上,您的 footer.html也包含覆盖header.html样式表的CSS样式表。
您可以这样做
* Header.html
*Header.html
<html>
<head>
add all the stylesheets here or combine them
</head>
<body>
<navigation>
</navigation>
* footer.html
*footer.html
<footer information goes here>
add javascript here
</body>
</html>
* index.php
*index.php
include ('header.html')
content goes here
include('footer.html')
这篇关于是否可能在同一个php文件中包含2个html页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!