Includes in php ?

Discussion in 'PHP' started by mailtoankit09, Jul 26, 2010.

  1. #1
    hello i have a problem in includes in php
    my problem is that i have a file called header.php in my root directory
    Ex> /public_html/header.php

    And i want to add this directory in every page because my all CSS and js in this file
    Is there any code for include this to

    /public_html/folder/folder2/folder3/index.php



    in short i want to use header.php to my every page directory please tell what the code i can use in pages then header.php get on everypage.



    please help thank you
     
    mailtoankit09, Jul 26, 2010 IP
  2. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    include($_SERVER['DOCUMENT_ROOT'] . '/header.php');
    
    PHP:
     
    Deacalion, Jul 26, 2010 IP
  3. mailtoankit09

    mailtoankit09 Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you so much :) its working
    and also for quick replying :)
     
    mailtoankit09, Jul 26, 2010 IP
  4. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    No problem. :)
     
    Deacalion, Jul 26, 2010 IP
  5. sandy_joy

    sandy_joy Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks sir,from last few days I also face the same Problem, now I also solve them, again thanks.
     
    sandy_joy, Jul 27, 2010 IP