RE: [PHP] Structuring large PHP programs
| From: | Jonathan Sharp | Date: | Thu, 15 Feb 2001 01:16:52 +0000 |
| Subject: | RE: [PHP] Structuring large PHP programs | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39787@lists.php.net to get a copy of this message | ||
do you include EVERY file in init.inc even if that script doesn't use it? So
if you have a db.inc and it doesn't use the db at all...is it included?
-Jonathan
> -----Original Message-----
> From: Joe Stump [mailto:jstump@zebulon.miester.org]
> Sent: Wednesday, February 14, 2001 5:11 PM
> To: Ben Peter
> Cc: John McCreesh; php-general@lists.php.net
> Subject: Re: [PHP] Structuring large PHP programs
>
>
> The way I normally do it is I have ONE main include (usually init.inc)
> and then all files that I might need throught my page I put in init.inc
>
> I works nicely for me.
>
> --Joe
>
> On Wed, Feb 14, 2001 at 09:15:35PM +0100, Ben Peter wrote:
> > John,
> >
> > part of this is a matter of taste - I would personally rather split this
> > into functions.
> >
> > BUT: even if you _are_ using functions, you should only include() the
> > file with the function when you need it, IF this part of the code is
> > getting large. This way, php will not need to parse code that it won't
> > need anyway.
> >
> > Ben
> >
> >
> > John McCreesh wrote:
> > >
> > > What is the best practice for structuring a PHP program which is
> > > becoming too large to manage as a single file? Should it be
> broken into
> > > a number of includes, e.g.:
> > >
> > > switch ($whatever) {
> > > case 0:
> > > include('case0.php');
> > > break;
> > > case 1:
> > > include('case1.php');
> > > break;
> > > case 2:
> > > include('case2.php');
> > > break;
> > > }
> > >
> > > or a number of functions:
> > >
> > > require('mylib');
> > > switch ($whatever) {
> > > case 0:
> > > case0();
> > > break;
> > > case 1:
> > > case1();
> > > break;
> > > case 2:
> > > case3();
> > > break;
> > > }
> > >
> > > Any thoughts, references to articles (couldn't find anything in
> > > PHPBuilder), etc gratefully received...
> > >
> > > Thanks - John
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
>
> ------------------------------------------------------------------
> -------------
> Joe Stump, PHP Hacker, joestump98@yahoo.com
> -o)
> http://www.miester.org http://www.care2.com
> /\\
> "It's not enough to succeed. Everyone else must fail" -- Larry
> Ellison _\_V
> ------------------------------------------------------------------
> -------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>