0

I have a php environment on a windows 7 machine. I would like to add php include path. I run all my php apps from the following folder:

c:\wamp\www(followed by the folder of the of the app I am developing)

Please Assist, I am new to php and still have a lot to learn.

if(!defined('PHPWORD_BASE_PATH')) { define('PHPWORD_BASE_PATH', dirname(FILE) . '/'); require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php'; PHPWord_Autoloader::Register();

user1783675
  • 346
  • 2
  • 7
  • 25

3 Answers3

2

if your include is in the same folder..

<? include "file.php"; ?>

I wrestled a bear once.
  • 22,983
  • 19
  • 69
  • 116
  • thanks, that gave me a better understanding of the problem. I was trying to make sense of the following statement: If your PHPWord working directory isn't your PHP include path you can set the PHPWord base path. To set the PHPWord base path open the PHPWord.php inside the root folder and edit the value of PHPWORD_BASE_PATH constant. – user1783675 Dec 11 '12 at 12:57
  • That sounds like an option where you can set a base path and it will treat all others as if it were in that directory so you don't have to type out the full path. see this post http://stackoverflow.com/questions/1787661/define-my-own-base-path-vs-set-include-path – I wrestled a bear once. Dec 11 '12 at 13:05
  • Thanks a lot Adelphia, I am getting smarter now – user1783675 Dec 11 '12 at 13:23
1

if your include file is in same folder you need to write as

<? include "file.php"; ?>

if it is inner folder you need to use

<? include "foldername/file.php"; ?>

if it is in one up folder you need to use

<? include "../file.php"; ?>
nickle
  • 4,636
  • 1
  • 13
  • 11
1

Let's say your script is c:\wamp\www\myscript\index.php and your other file is c:\wamp\www\myscript\something_else.php.

Then you can use any of the following:

<? include("c:\wamp\www\myscript\something_else.php"); ?>
<? include("something_else.php"); ?>

The last one works if both files are in the same folder.

chrki
  • 6,143
  • 6
  • 35
  • 55