NYCPHP Meetup

NYPHP.org

[nycphp-talk] Include File Access

Rudy Gamberini rudy at taytek.com
Mon Sep 8 14:02:23 EDT 2003


Give the following web site file architecture:

           Root
              |
     -----------------------------
     |                 |              |          |
page1         page2      page3    inc

I place my util.php file in the "inc" directory.  As it turns out I need to
access this file from the Root directory as well as the various page
directories.  While I can place the relative path to the include file with
{ include "./inc/util.php"  } for the Root and   { include
"../inc/util.php" }  for the sub-pages, this causes problems with my common
code.

I construct my pages with common code that controls the left side of the
page.  This code utilizes the functions in the util.php include.  As it
stands now the include fails because the util.php file cannot be found.  I
really don't want to modify this include statement for each of my pages
depending on their depth relative to the directory containing the include
files.

Granted I could flatten the site structure and get rid of this problem but
that would create considerable complexity when trying to work on the site.

I was thinking about creating an environment PATH to the inc directory as
one way to keep the include code that same and still be able to access the
util.php file.

Any suggestions??

Thanks,
Rudy


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/03
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030908/22709b12/attachment.html>


More information about the talk mailing list