Auto content <?Include

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Auto content <?Include

    Pls can some one help me with code to show my header and footer
    i tried

    <?
    include 'http://www.YOURSITE.com/header.php'
    ?>

    but did not work

    #2
    Just use

    include('path_to_header/header.php');

    Where path_to_header is the dir where your file is found
    Perfection comes at a cost



    I accept liberty!

    Comment


      #3
      include "header.php";

      include "footer.php";

      Comment


        #4
        <?php
        include("header.php");
        ?>
        //////////////////////////try this u r missin php tag also make a header php
        <?php
        echo"<title>your name</title>";
        ?>

        Comment


          #5
          if the 'page.php' in which header to be included and 'header.php' are in same folder the bel0w sh0uld work:
          <?
          php include("header.php");
          ?>
          again if 'header.php' is in main root directory and 'page.php' is in subfolder..the below should work:
          <?php
          include("../header.php");
          ?>
          and n0w if page.php is in another folder within the subfolder the below should work:
          <?php
          include("../../header.php");
          ?>
          and g0es0n. .hope u g0t it
          Last edited by suael; 18.02.11, 14:54.

          Comment


            #6
            Thanks every one but the code did not work, may be the problem is from my host => my3gb.com.

            So can any one help me with a good host?

            Comment


              #7
              Originally posted by bestman View Post
              Thanks every one but the code did not work, may be the problem is from my host => my3gb.com.

              So can any one help me with a good host?
              theres no way a host supports php and turns off includes thats crap. Maybe ur nt getting the right path. Copy and save the following code in ur document root. Save the "header.php" in the same directory.

              PHP Code:
              <?php
              // Path to your document root
              define('DOCROOT'realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);

              // Make sure "header.php" is saved in the same directory as "index.php"
              include DOCROOT.'header.php';

              Comment


                #8
                Originally posted by CreativityKills View Post
                theres no way a host supports php and turns off includes thats crap. Maybe ur nt getting the right path. Copy and save the following code in ur document root. Save the "header.php" in the same directory.

                PHP Code:
                <?php
                // Path to your document root
                define('DOCROOT'realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR);

                // Make sure "header.php" is saved in the same directory as "index.php"
                include DOCROOT.'header.php';
                thanks i will try it

                Comment

                Working...
                X