我有2个包含文件header.php和footer.php,我无法加载它们togheter以在一个输出中合并所有togheter。在我看了一堆教程后,我无法正确显示它们,因为我无法理解我在尝试中失败的地方。我必须提到我是新手,有人请帮助我。
的header.php
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Despre Noi</title>
<link rel="stylesheet" href="stylesheets/style.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<div class="social">
<a href="#"><img src="images/rss_3.gif" alt="social" width="16" height="16" border="0" /></a> <a href="#"><img src="images/rss_2.gif" alt="rss" width= "16" height="16" border="0" /></a> <a href="#"><img src="images/rss_1.gif" alt="rss" width="16" height="16" border="0" /></a> Urmaritine pe canele Sociale
</div><!---end of social-->
<div class="clr"></div><!--end of clr-->
<div class="logo">
<a href="index.html"><img src="images/logo.jpg" width="313" height="115" border="0" alt="logo" class="one"/></a>
</div><!--end of logo-->
<div class="menu">
<ul>
<li><a href="index.html" class="active"><span>Acasa </span></a></li>
<li><a href="services.html"><span>Servicii</span></a></li>
<li><a href="services.html"><span>Cocktail</span></a></li>
<li><a href="about.html"><span> Despre Noi </span></a></li>
<li><a href="contact.html"><span> Contact </span></a></li>
</ul>
</div><!--end of menu-->
<div class="clr"></div><!--end of clr-->
</div><!--end of header-->
</div><!--end of main_header-->
about.php
<pre><code>
<?php
include('root/includes/header.php');
?>
<div class="body_container">
<div class="body">
<div class="body_bg">
<h2>Despre Noi</h2>
<
<p> aaaaaaaaaaaaa</p>
<p> aaaaasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<div class="clr"> </div>
</div><!--end of body_bg-->
<div class="left">
<h2>Who we are<br />
<a href="#" class="about">We bring value innovation and growth to your business</a></h2>
<p>Nullam aliquam porttitor risus vel porta. Quisque porttitor posuere diam. Aenean vel dapibus leo. Quisque non neque dolor, vel imperdiet massa. Quisque a enim ac nisl tincidunt pharetra id ut nulla.<br />
In vitae metus at neque elementum condimentum. Quisque fringilla porta metus, in posuere tellus ullamcorper in. Sed at metus velit. Aliquam consequat venenatis tortor, vel elementum mi laoreet tristique. </p>
<h2>Our Mission</h2>
<p>Sed tincidunt turpis posuere neque dictum quis faucibus felis tempus. Ut faucibus sem a nisi feugiat volutpat. Vivamus quis vulputate mauris. In suscipit sollicitudin mattis. Integer non nisl eu metus dapibus dapibus. Maecenas dui urna, luctus ac posuere at, semper vel lectus. Etiam lobortis porttitor tellus, ac adipiscing leo scelerisque ac. Aliquam iaculis orci sit amet est consequat tempus. Pellentesque quis dui ut purus auctor egestas. Ut ligula neque, aliquam elementum bibendum vitae, suscipit dictum lacus. <br />
Proin lobortis consectetur eros vel mattis. Nullam aliquam porttitor risus vel porta. Quisque porttitor posuere diam. Aenean vel dapibus leo. Quisque non neque dolor, vel imperdiet massa. Quisque a enim ac nisl tincidunt pharetra id ut nulla.</p>
<h2> </h2>
</div>
<div class="right">
<h2>News and Events</h2>
<p><a href="#" class="about">12 Dec 2015 | 0 comments</a><br />
<strong>Duis nec porttitor lorem</strong><br />
Integer lacus ante then ante ullamcorper ut vulputate..</p>
<p><a href="#" class="about">18 Dec 2015 | 5 comments</a><br />
<strong>Aenean interdum</strong><br />
Vestibulum ante ipsum luctus ultrices antene posuere.</p>
<p><a href="#" class="about">4 Jan 2015 | 2 comments</a><br />
<strong>Integer vitae nisl</strong><br />
Duis volutpat ligula laoreet orci lectus placerat <br />
Curabitur lectus malesuada pulvinar.</p>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
</div>
<?php include('includes/footer.php');
?>
</code></pre>
footer.php
<div class="footer">
<div class="footer_container">
<a href="/"><img src="images/footer_logo.gif" alt="logo_footer" width="145" height="59" border="0"/></a>
<p class="right">© Copyright First Class Cocktail.
<a href="#">Home</a> |
<a href="#">Servicii</a> |
<a href="#">Cocktail</a> |
<a href="#">Despre Noi</a> |
<a href="#">Contact</a><br/>
<div class="clr"> </div>
</div><!--end of footer container-->
<div class="clr"></div>
</div><!--end of footer-->
</div><!--end of container-->
</body>
</html>
请帮助我,如果这是一个简单的解决方案,我会提前道歉!谢谢你
答案 0 :(得分:1)
header.php文件中有一个额外的End Container </div>
。实际上,如果您想在footer.php文件中结束容器,请从header.php中删除</div>
,否则,请从footer.php中删除它。
你的页脚也应该在root/includes/footer.php
答案 1 :(得分:0)
您的实际文档中是<pre><code>
吗?如果是这样,您需要删除它,因为它不会正确处理它下面的任何代码,因此您的包含将无法正常工作。
如果修复了这个问题,假设'root / includes / .php'是你的页眉/页脚从about.php文件位置的实际位置,这应该加载。再次,确保路径是正确的从about.php文件的目录(这将意味着在about.php文件所在的文件夹中有一个名为root的目录)。