NYCPHP Meetup

NYPHP.org

[nycphp-talk] FUNDAMENTALS #1: Site Structure

Brian Pang bpang at bpang.com
Fri Sep 5 20:30:02 EDT 2003


> On Fri, Sep 05, 2003 at 04:27:03PM -0400, Brian Pang wrote:
> > 
> > Using .inc is just way too confusing for me, so mine all get .php
> > .inc doesn't tell me what language I'm dealing with, nor does it give
> > good syntax coloring, at least not automatically.
> 
> Confusing to me is wondering if a file named "a.php" is a script which is
> going to be viewed/executed or is just a bunch of included functions.
> 

I see your point, but it would be in the includes dir so that's how I
would know.


> 
> > Regarding portability, at the beginning of every file I put
> > require_once($_SERVER['DOCUMENT_ROOT'] . "/LIB.php");
> 
> And if your files are not in the document root and the tree structure 
> differs between the development machine and the server?

only the LIB.php needs to go in the document_root.
Then it can set the $INCLUDES, $FUNCTIONS, etc vars to
$INCLUDES = "/path/to/includes/dir";

I try to at least use sym links so that my servers have similar trees.
Ideally, the machines are twins, but in the event that they are not (dev
machine is a workstation?) you could just maintain 2 separate LIB.php
files with different paths.

dev
$INCLUDES = "/dev/path/to/includes";

production
$INCLUDES = "/prod/path/to/includes";

The files which call LIB.php can be anywhere under the www root as
$_SERVER['DOCUMENT_ROOT'] won't change. Document_root is always the www
root.



> 
> > where LIB.php sets some variables for me, like the location of includes,
> > images, functions, webroot/domainname, classes, etc. as $INCLUDES,
> > $FUNCTIONS, $IMAGES, $WEBROOT, etc
> 
> Nice.

yeah, works for me

> 
> --Dan
> 
> ... snipped rest to save bandwidth and storage, the nice thing to do...
> 
> -- 
>      FREE scripts that make web and database programming easier
>            http://www.analysisandsolutions.com/software/
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 






More information about the talk mailing list