Auto content <?Include
Started on the old forum in February 2011 · view the original in the archive · old links redirect here
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!
include "header.php";
include "footer.php";
Meet New FACES and Gain More FRIENDS!!! http://www.facesnfriends.com%208%29
//////////////////////////try this u r missin php tag also make a header php
<?php echo"<title>your name</title>"; ?>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
bestman wrote: 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
// 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';
CreativityKills wrote: 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 // 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