Auto content <?Include

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

7 replies · 585 views · started 15 years ago · 1 min read

6 participants
bestman Junior · 32 posts #1

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

frostymarvelous Senior · 266 posts #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!

wapcult Developer · 53 posts #4
<?php include("header.php"); ?>

//////////////////////////try this u r missin php tag also make a header php

<?php echo"<title>your name</title>"; ?>

VISIT US FOR FREE EARN

http://POCK.IN

MOBILE ADVERTISEMENT & EARN MONEY

suael Junior · 27 posts #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

bestman Junior · 32 posts #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?

CreativityKills Lead · 833 posts #7

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';
bestman Junior · 32 posts #8

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

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close