[PHP Includes] Simple - but confused?

Soldato
Joined
12 Jun 2005
Posts
5,361
Hi there,

I am stuck on using an Include in PHP. I have tried:

Basic Include:
Code:
<?php
include 'includes/theader.inc';
include 'tutorials.inc';
include 'includes/tfooter.inc';
?>

Http Include:

Code:
<?php
include 'http://www.bf2tricks.ubersol.co.uk/verynew/includes/theader.inc';
include 'http://www.bf2tricks.ubersol.co.uk/verynew/tutorials.inc';
include 'http://www.bf2tricks.ubersol.co.uk/verynew/includes/tfooter.inc';
?>

The three files are:

theader.inc (In an includes folder)
tfooter.inc (In an includes folder)
tutorials.php (In the same folder)

I am trying to include them all together to make my page and I get nothing: Click Here. What am I doing wrong?

Thanks...

[Edit]

As there is no index page as of yet, you can view my file structure: Click Here
 
Last edited:
Hi there,

Thanks for the response. Yes I believe that all the paths are correct. You can check yourself by looking at my file structure: Click Here

I have added the error reporting, but nothing happens either, unless I have to look in a specific area for a log of errors? (Never used error reporting before)

Thanks...
 
Beansprout said:
Seeing as www.ubersol.co.uk doesn't even work I wouldn't hold out much hope of, well, anything working.

Hmm, :(.........well I payed 11p I can't really complain :D. I can access my cPanel OK.

Beansprout said:
What's the code for the PHP files?

Sorry I don't understand what you mean by this? All the PHP that is in the "site" is shown there.

Thanks...
 
Hehe :)

Thanks for all your help anyway...theres my 11p down the drain :(

Thanks...

[edit]

Just looked at my error log in cPanel and there are 100s of "PHP Warnings"......:(
 
Last edited:
Hi there,

Sorry to drag up an old topic, but my I ask why the require function is better than include?

or is this the only advantage:

php.net said:
require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well.

Thanks...
 
Back
Top Bottom