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();

3 Answers 3

2

if your include is in the same folder..

<? include "file.php"; ?>

Sign up to request clarification or add additional context in comments.

3 Comments

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.
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 stackoverflow.com/questions/1787661/…
Thanks a lot Adelphia, I am getting smarter now
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"; ?>

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.