Re: Setting or Getting Relative Path for PHP Includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can use a directive on your .htaccess:

php_value  include_path   /your/include/path/here

This can also be set on your httd.conf  in a virtual server basis. If
you have access to php.ini is better to set the include there.

Regards,
Jordi.

On Mon, 20 Dec 2004 12:41:06 -0800, Anthony Baker
<lists@xxxxxxxxxxxxxxxxx> wrote:
> Hey Folks,
> 
> Hoping someone can aid me with a newbie-ish question.
> 
> I often use PHP includes in my files to pull in assets, but I hard code
> the relative path to the root html directory for the sites that I'm
> working on in each file. Example below:
> 
> <?php
>   $path = '/home/virtual/sitename.com/var/www/html/';
>   //relative path to the root directory
>   $inc_path = $path . 'code/inc/';
>   //path and folder the code includes folder is located
>   $copy_path = $path . 'copy/';
>   //path and folder the copy is located
> ?>
> 
> I'd like to be able to set the relative path as a global variable from
> an external file so that I can modify one line of code to change the
> relative path across the site. This will allow me for easier coding in
> staging and development environments.
> 
> What's the best way to do so? Can anyone provide a code example?
> 
> Either that, or is there a way to call this variable from the server
> itself so that it's automatically -- and correctly -- set?
> 
> Thanks,
> 
> Anthony
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux