0

我有 2 个包含文件 header.php 和 footer.php,但我无法将它们加载到一起以将所有一起合并到一个输出中。在我看了一堆教程阅读了多篇文章后,我无法正确显示它们,我不明白我在哪里可能会失败。我不得不提到我是新手,请有人帮助我。

头文件.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-->

关于.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>&nbsp;</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>

页脚.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>

请帮助我,如果这是一个简单的解决方案,我会提前道歉!谢谢你

4

2 回答 2

0

<pre><code>您的实际文档中吗?如果是这样,您需要删除它,因为它不会正确处理它下面的任何代码,因此您的包含将不起作用。

如果这是固定的,假设'root/includes/.php'是你的页眉/页脚从about.php文件的位置的实际位置,这应该加载。再次,确保您的 about.php 文件目录中的路径正确(这意味着在 about.php 文件所在的文件夹中有一个名为 root 的目录)。

于 2013-10-14T14:36:46.480 回答
0

您的 header.php 文件中有一个额外的 End Container </div>。事实上,如果你想在 footer.php 文件中结束你的容器,</div>从你的 header.php 中删除,否则,从 footer.php 中删除它。
你的页脚也应该在root/includes/footer.php

于 2013-10-14T14:37:11.153 回答