Re: Structuring large PHP programs

From: Date: Wed, 14 Feb 2001 21:53:06 +0000
Subject: Re: Structuring large PHP programs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-39751@lists.php.net to get a copy of this message
I would use a combination of both, Have all of your backend settings (including db info) in one include, and all of your user customisable settings (if you have any) in another include and finally another include for all your functions, so that any function is aviable at anytime. But this doesn't mean that you need to have three include() statements at the top of your page. Simply make refference to require('settings.inc'); then in this settings.inc file maintain all of your other includes to files. This way if you want to create another include, all you have to do is add it to settings.inc and then it is inlcuded in everyfile that settings.inc is included in! Scott Mebberson Redblue Design "John McCreesh" <john.mccreesh@nospam.cwcom.net> wrote in message news:eNY9OHApmui6EwjK@harlawroad.freeserve.co.uk... > 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 >

« previous php.general (#39751) next »