Reply to Re: How to make the include path universal?

Your name:

Reply:


Posted by tom pester on 09/06/05 13:52

Hi Walter

This is a good solution that AFAIK minimizes the poblem cause you still have
to include var.php in each file.
And the path to the var.php suffers the same problems now but it's only here
that the problem surfaces.

**** code ****
include_once 'var.php'; // You didn't mention this line but its required
in every file right?
include_once INCLUDE_PATH . 'base_functions.php';
**** code end ****

the
include_once 'var.php'
is not universal for each file since it breaks if the file that includes
it is in another directory, fe ;

include_once 'var.php'
becomes
include_once '../var.php'

For the rest its a fine solution. Can you conform that's how you ment it?
I'm still learning the details of the language..

Cheers,
Tom Pester

> We solve the prolbem by defining a base "vars.php" file at the "root"
> of the site.
>
> In there we define paths to constants, and then these constants are
> used to INCLUDE files as needed.
>
> var.php
>
> define( INCLUDE_PATH, '/my/path/includes/');
>
> now I can incluse my files as Ineed
>
> include_once INCLUDE_PATH . 'base_functions.php';
>
> All you need to do is update that one constant as you move from site
> to site and it works fine.
>
> Linux or windows.
>
> walter
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация