16 Replies Latest reply on Feb 14, 2015 1:57 PM by Rob Hecker2

    PHP include command covers all other page content in dreamweaver

    Max Resnikoff Level 1

      Hi,

       

      I am having problems with my php include command.

       

      I have aheader which needs to be on every page, but when I include it in a page, it stops displaying the page's original content.

      To be able to edit the pages (not the include header file), i have to comment out or remove the php include so that the original content is displayed and can be edited.

       

      Is there a reason for this?

       

      <!doctype html>

      <?php include("_header.php"); ?>

      <html>

      <link href="stylesheets/main_stylesheet.css" rel="stylesheet" type="text/css">

      <link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>

      <head>

      <meta charset="utf-8">

      <title>Welcome</title>

      </head>

       

      <body>

      This is the body of this page

      </body>

      </html>

        • 1. Re: PHP include command covers all other page content in dreamweaver
          TwoSuits Level 2

          If your  _header.php partial file contains HTML output it should be included in the body:

           

          <!doctype html>

          <html>

          <link href="stylesheets/main_stylesheet.css" rel="stylesheet" type="text/css">

          <link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>

          <head>

          <meta charset="utf-8">

          <title>Welcome</title>

          </head>

           

          <body>

          <?php include("_header.php"); ?>

          This is the body of this page

          </body>

          </html>

          • 2. Re: PHP include command covers all other page content in dreamweaver
            MurraySummers Level 8

            Show us the content of the PHP include, please.

            • 3. Re: PHP include command covers all other page content in dreamweaver
              Max Resnikoff Level 1

              I just tried that and still no luck.

              I still cant see or edit: "This is the body of this page" in the design view.

               

              This is the _header:

               

              <head>

              <link href="stylesheets/header_stylesheet.css" rel="stylesheet" type="text/css" />

              <meta name="viewport" content="width=device-width, initial-scale=1">

              <!-- Favicon -->

              <link rel="shortcut icon" type="image/png" href="images/favicon.png" />

              <!-- Google Fonts -->

              <link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>

               

              <!--Transition Pre-Load-->

              <script>

              $(window).load(function() {

                $("body").removeClass("preload");

              });

              </script>

               

               

              <title>Default Header</title>

              </head>

               

               

              <body>

              <div class="wrapper">

                  <div class="home_button">

                      <img src="images/icons/house28.png" width="31" height="30" alt="Home" />

                  </div>

                  <div class="colourtabs">

                      <div class="colourtab_egham"></div>

                      <div class="colourtab_cobham"></div>

                      <div class="colourtab_hillingdon"></div>

                      <div class="colourtab_doha"></div>

                  <div class="colourtab_session"></div>

                  </div>

                 

                <div class="sessiontab">

                    <div class="sessiontab_date">

                    <script language = "JavaScript">

              var now = new Date();

              var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

              var monNames = new Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");

              document.write(now.getDate() + ", " + monNames[now.getMonth()] + "  " + now.getFullYear());

              </script>

                      </div>

                    <div class="sessiontab_name">Welcome, *USERNAME</div>

                  <div class="sessiontab_buttons">

                          <div class="sessiontab_button" align="center">

                              <img src="images/icons/contact11.png" width="33" height="33" alt="Profile" />

                          </div>

                          <div class="sessiontab_button" align="center">

                              <img src="images/icons/calendar146.png" width="33" height="33" alt="Calendar" />

                          </div>

                          <div class="sessiontab_button" align="center">

                              <img src="images/icons/logout20.png" width="33" height="33" />

                          </div>

                    </div>

                  </div>

                 

                 

                 

                <div class="titles">

                      <div class="titles_logo_large">

                          <img src="images/logo.png" width="402" height="57" alt="ACS Egham International School" />

                      </div>

                      <div class="titles_text" >

                          Drama Database

                      </div>

                  </div>

                 

                  <div class="logo_icon">

                      <img src="images/logo_icon.png" width="63" height="57" alt="ACS Egham International School">

                  </div>

               

                  <!--NavBar-->

                      <ul class="navbar">

                          <li><a href="">Equipment</a></li>

                          <li><a href="">Props</a></li>

                          <li><a href="">Costumes</a></li>

                          <li><a href="">Set</a></li>

                          <li><a href="">Books</a></li>

                          <li><a href="">Resources</a></li>

                      </ul>  

              </div>

              </body>

              • 4. Re: PHP include command covers all other page content in dreamweaver
                TwoSuits Level 2

                You are including a file which has a head and body section into another file which also has a head and body section so only the included file is displayed.

                 

                If you think of your include as pasting the include file contents into the main file at the position of the include tag. In your case this is causing a HTML page within a HTML page.

                • 5. Re: PHP include command covers all other page content in dreamweaver
                  Max Resnikoff Level 1

                  So just get rid of the html tags (head body etc)?

                  • 6. Re: PHP include command covers all other page content in dreamweaver
                    TwoSuits Level 2

                    Try this:

                     

                    Main File contents:

                     

                    <!doctype html>

                    <html>

                    <meta name="viewport" content="width=device-width, initial-scale=1">

                    <!-- Favicon -->

                    <link rel="shortcut icon" type="image/png" href="images/favicon.png" />

                    <!-- Google Fonts -->

                    <link href='http://fonts.googleapis.com/css?family=Slabo+27px' rel='stylesheet' type='text/css'>

                    <!--Transition Pre-Load-->

                    <script>

                        $(window).load(function() {

                          $("body").removeClass("preload");

                        });

                    </script>

                    </head>

                     

                    <body>

                    <?php include("_header.php"); ?>

                    This is the body of this page

                    </body>

                    </html>

                     

                    _header.php contents:


                    <div class="wrapper">

                      <div class="home_button"> <img src="images/icons/house28.png" width="31" height="30" alt="Home" /> </div>

                      <div class="colourtabs">

                        <div class="colourtab_egham"></div>

                        <div class="colourtab_cobham"></div>

                        <div class="colourtab_hillingdon"></div>

                        <div class="colourtab_doha"></div>

                        <div class="colourtab_session"></div>

                      </div>

                      <div class="sessiontab">

                        <div class="sessiontab_date">

                              <script language = "JavaScript">

                                var now = new Date();

                                var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

                                var monNames = new Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");

                                document.write(now.getDate() + ", " + monNames[now.getMonth()] + "  " + now.getFullYear());

                            </script>

                        </div>

                        <div class="sessiontab_name">Welcome, *USERNAME</div>

                        <div class="sessiontab_buttons">

                          <div class="sessiontab_button" align="center"> <img src="images/icons/contact11.png" width="33" height="33" alt="Profile" /> </div>

                          <div class="sessiontab_button" align="center"> <img src="images/icons/calendar146.png" width="33" height="33" alt="Calendar" /> </div>

                          <div class="sessiontab_button" align="center"> <img src="images/icons/logout20.png" width="33" height="33" /> </div>

                        </div>

                      </div>

                      <div class="titles">

                        <div class="titles_logo_large"> <img src="images/logo.png" width="402" height="57" alt="ACS Egham International School" /> </div>

                        <div class="titles_text" > Drama Database </div>

                      </div>

                      <div class="logo_icon"> <img src="images/logo_icon.png" width="63" height="57" alt="ACS Egham International School"> </div>

                     

                      <!--NavBar-->

                      <ul class="navbar">

                        <li><a href="">Equipment</a></li>

                        <li><a href="">Props</a></li>

                        <li><a href="">Costumes</a></li>

                        <li><a href="">Set</a></li>

                        <li><a href="">Books</a></li>

                        <li><a href="">Resources</a></li>

                      </ul>

                    </div>

                    • 7. Re: PHP include command covers all other page content in dreamweaver
                      Rob Hecker2 Adobe Community Professional & MVP

                      So just get rid of the html tags (head body etc)?

                       

                      Max, if you are asking this question, then I wonder if you are getting TwoSuits' point. An include is not like an HTML frame. It isn't a page within a page. It is just a chunk of the script stored somewhere else so it can be reused. So, for instance, the body tag can be in either the page or the include, but not both.

                      • 9. Re: PHP include command covers all other page content in dreamweaver
                        TwoSuits Level 2

                        I am assuming the code edits I supplied worked ok for you? Do you understand what you did wrong in the first place?

                        • 10. Re: PHP include command covers all other page content in dreamweaver
                          Max Resnikoff Level 1

                          yep thanks!

                           

                          one last thing; If i wanted to make the header static, would i make it static on the include page or the insert page?

                          • 11. Re: PHP include command covers all other page content in dreamweaver
                            MurraySummers Level 8

                            Either since the final page is the merger of both files. But what do you mean by "make the header static"?

                            • 12. Re: PHP include command covers all other page content in dreamweaver
                              Max Resnikoff Level 1

                              I mean i want to have the header stay at the top of the page when scrolling

                              • 13. Re: PHP include command covers all other page content in dreamweaver
                                Nancy OShea Adobe Community Professional & MVP

                                Sticky header is effected by your global CSS code.  That should be inside your external style sheet to which your parent document is linked. 

                                 

                                 

                                Nancy O.

                                • 14. Re: PHP include command covers all other page content in dreamweaver
                                  Max Resnikoff Level 1

                                  ok the fixed header is done, but the problem i am having is that if i remove all html tags (in this case 'body')(in the header file), then the div tag which the header content is in is not filling the edges whereas when there is a body tag, i can specify: margin:0px and there will be no gaps around the header.

                                  • 15. Re: PHP include command covers all other page content in dreamweaver
                                    Nancy OShea Adobe Community Professional & MVP

                                    Your parent document's external style sheet needs to cover everything.

                                     

                                     

                                    Nancy O.

                                    • 16. Re: PHP include command covers all other page content in dreamweaver
                                      Rob Hecker2 Adobe Community Professional & MVP

                                      the problem i am having is that if i remove all html tags. . .

                                       

                                      No one told you to remove all HTML tags. Don't duplicate them.