[UPHPU] Site includes - variables
Mitch Anderson
mitch at metauser.net
Thu Jun 26 00:04:35 MDT 2003
Problem with including the db(say db.php) info and other things, is that
if one script calls db.php, and calls something say func1.php, and
func1.php calls db.php as well, it will return an error, saying that the
functions have already been declaired. which dropping db.php out of
func1.php would be the simple fix, but what if func1.php is called
directly and needs db.php... then i have a problem.
i thought that if i included everything in one file with the
"include_once("func1.php");" then, it would only be included once when
there was something in it I needed, but would keep in in memory if it
was used again. But if there was never anything needed in it, it would
never be used. Thats what I got out of the docs... am I wrong?
On Wed, 2003-06-25 at 13:29, Brady Mitchell wrote:
> What I do is make a file that has the db info and things that are needed
> for the entire site and include that file in every script. That way you
> don't even have to think about if the variables are registered as
> globals or not.
>
> Then if there are functions only needed by specific sections of the site
> those are included only in those files. You could even use variables to
> decide which files are included which might make it a little easier...
> Not sure about security issues of doing that though, might want to
> consult google or someone on the list who knows more about security then
> I do.
>
> A concern with including everything in one file is that it will increase
> processing time & effort - which isn't a big deal if you've only got a
> couple small functions, but from your diagram it looks like you're going
> to have quite a few functions...
>
> HTH,
>
> Brady
>
> -----Original Message-----
> From: Mitch Anderson [mailto:mitch at metauser.net]
> Sent: Wednesday, June 25, 2003 12:23 PM
> To: list at uphpu.org
> Subject: [UPHPU] Site includes - variables
>
>
> I've been waiting for some traffic so i could create my filters :)
>
> Quick question however...
>
> Whats the best way to create a site thats using lots of php functions?
> Like how would the best way to implement include files and site wide
> configuration settings. Currently, this is how I have been writting my
> site.
>
> index.php
> |
> includes.php
> |
> func1.php -- func2.php -- func3.php -- func4.php
> |
> func_db.php
>
> Does that seem logical? Basically index.php(or any other page on the
> site) would include includes.php, which includes all of the other
> function php files (all containing different types of functions grouped
> on common types)
>
> Only problem with this is that having a site wide configuration variable
> like the sites name, database connection info, URL, file locations, etc,
> would have to be registered as globals...(or put in the file that will
> be using them... which is undesirable, as a central place to manage them
> is ideal) I was just wondering if there is a better way to handle this
> or does that sound right?
>
> any ideas would be appreciated.
>
> Mitch
>
> On Wed, 2003-06-25 at 12:03, Scott Pepperdine wrote:
> > Just checking to see if the list works. No traffic since I
> > subscribed.
> >
> > Thanks,
> >
> > Scott
> >
> >
> > Scott Pepperdine
> > Integrated Medical Systems
> > scottp at imshelp.com
> > (801) 794-9520
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: list-unsubscribe at uphpu.org
> > For additional commands, e-mail: list-help at uphpu.org
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: list-unsubscribe at uphpu.org
> For additional commands, e-mail: list-help at uphpu.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: list-unsubscribe at uphpu.org
> For additional commands, e-mail: list-help at uphpu.org
>
>
More information about the UPHPU
mailing list