Just a little bit of help needed with the include function

This is a discussion on Just a little bit of help needed with the include function within the PHP Language forums, part of the PHP Programming Forums category; Hi there, Say I have three files: test.php /test53/test.php /test692/test83/test.php ... and I want to ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-28-2003
Chris J
 
Posts: n/a
Default Just a little bit of help needed with the include function

Hi there,

Say I have three files:
test.php
/test53/test.php
/test692/test83/test.php

... and I want to include "test2.php" and "test3.php" which are in the
main directory on each of the above pages ... I can't do <?php
include("header.php");?>
This is a test page!
<?php include("footer.php"); ?>

because the files are not in all of the directories.

How do I include "test2.php" and "test3.php" on each page with no
problems? I've tried

<?php include("www.domain.com/test2.php");?>
This is a test page!
<?php include("www.domain.com/test3.php"); ?>

on all pages.
However this gives errors. Please could someone assist?

Thanks
Reply With Quote
  #2 (permalink)  
Old 10-28-2003
Kevin Thorpe
 
Posts: n/a
Default Re: Just a little bit of help needed with the include function

Chris J wrote:

> Hi there,
>
> Say I have three files:
> test.php
> /test53/test.php
> /test692/test83/test.php
>
> .. and I want to include "test2.php" and "test3.php" which are in the
> main directory on each of the above pages ... I can't do <?php
> include("header.php");?>
> This is a test page!
> <?php include("footer.php"); ?>
>
> because the files are not in all of the directories.
>
> How do I include "test2.php" and "test3.php" on each page with no
> problems? I've tried
>
> <?php include("www.domain.com/test2.php");?>
> This is a test page!
> <?php include("www.domain.com/test3.php"); ?>
>
> on all pages.
> However this gives errors. Please could someone assist?


include works at the system level. Hence it knows nothing about the URL.

include("$_SERVER[DOCUMENT_ROOT]/test2.php");

will do what you were trying to do. Alternatively put them in a separate
directory and add that to your include path.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0