LinkShare  Referral  Program

New

Advertise ad Here
learn more
            PHP > PHP Include
Useful

Links


Free technical Tutorials At techtutorials.net



Link Exchange at iWEBTOOL.com

 



The PHP Resource Index


iBuyOfficesupply.com Inc. There are N. 1 Comments for this Article
Ask any relevant question in the Comments or leave your valuable feed-back

printer  Print version of this article

star  Add it to your favourite!

mail email this page to a frend
LinkShare  Referral  Program
Added on   2008-01-12
Clicks     3040
Rating:   4.50   out of 5 from   2   raters      
         rate this page   
 Not rated yet.Be the first one to vote!!

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;
      }


    Comments

    Post your comment here or ask any question that is rilevant on what is shown in this page.
    Thank you for visiting this website

    N. 1 Comments for this page!   add a comment


    From:  Mart   Comment Nr 1    
     Posted on  16/10/08
      
     nice work
  • How to use PHP with HTML/HTM pages



  • i