PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

How can I include files with a different directory in php?

Asked 2010-03-08 19:01:12 by Em-Em

For example, I have a folder named sample and inside it are two folders sample1 and sample2... inside sample1 is sample1.php and inside sample2 is sample2.php... How can I include sample1.php in sample2.php... Any help is highly appreciated... thanks...

Anwered 2010-03-08 19:05:42 by William K

Learn simple html. Relative vs Absolute links i think.

http://www.compugoddess.com/relvsabs.htm

Im not quite getting your question though or you might just be talking about the php function
include
http://php.net/manual/en/function.include.php

Anwered 2010-03-09 05:32:57 by Gitlez

Simplest way, as far as I know:

require_once('../sample1/sample1.php');
-- or --
include('../sample1/sample1.php');

Depending on the contents and purpose of sample1.php

Search php.net for the functions 'include' and 'require'

Questions and answers provided by the Yahoo Answers Community.