Maniacomputer Web Mail     Powered bydeskNow
     Learn More
    or     Register
Useful

Links


Free technical Tutorials At techtutorials.net



Link Exchange at iWEBTOOL.com

 


For the graphics you need on your website

For javascript
373
            PHP > PHP Include
 Rate this Page:    your vote is welcome
 Current rating:  3   out of 5 from   1   raters        

How to run PHP in any web Pages

  • How to use PHP include function
  • How to use PHP with HTML/HTM pages


  • How to use Include PHP code


    

    To easily mantain your website ,specially if it has many pages ,PHP include function is probably one of the  best solution.Say,for instance, you have to update or change only the header or navigation or any section that is the same in all the pages, you must edit them separately one by one,and it will take a lot of time and the risk of making mistakes is high.

    But if you create few include files ,everything will be easier and you'll be able to change or update all your site from one page only.
    Also you can include content to your pages from other websites.

    How PHP Include function works

    In this example you'll see how to make the top and bottom of your pages dynamic,but you can use this principle to any section.So you will be able to change the top of your 1000 pages web site by editing only 1 single page. Obviously the first requisite is to have PHP running on the Web Server that hosts your website.

    This is a normal web page using HTML and CSS  (testInclude.css) to style the page.



      <html>

      <head>
      <title> Test Include Page</title>

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

      </head>
      <body>
      <!-HEADER->
      <div class="header">
      This is the Header
      </div>
      <!-HEADER->
      <div class="container">
      All your content Here
      </div>
      <!-FOOTER->

      <div class="bottom">This is the Bottom
      </div>
      <!-FOOTER->

      </body>
      </html>




      .header {
      width: 100%;
      background-color: #33CC33;
      text-align: center;
      font-weight: bold;
      font-size: large;
      }
      .container {
      width: 100%;
      background-color: #DEDDDA;
      font-size: medium;
      color: #000080;
      height: 300px;
      position: relative;
      }
      .bottom {
      width: 100%;
      border: thin solid #0000FF;
      background-color: #FFCC00;
      font-size: medium;
      font-weight: bold;
      text-align: center;
      margin-right: auto;
      margin-left: auto;
      }


  • How to use PHP with HTML/HTM pages