Re: Re: include question

From: Date: Tue, 18 Sep 2001 17:48:32 +0000
Subject: Re: Re: include question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67736@lists.php.net to get a copy of this message
include loads the entire file. I do something similar with my functions (Keep them in a seperate file, and include them when needed) I will usually have multiple function files, grouped by function... for example, I have one file for error reporting functions, one file for authentication functions, one file for database manipulation functions, etc etc.... then, I just include whatever file holds the needed function where it is needed. My reason for doing this is to keep everything modular. (I have multiple domains, and like to reuse my code.. it's easier to have files for specific function sets, than to maintain a single large file) BUT, keep in mind: The server loads the entire file into memory, which is done extremely fast, and the processes it based on your control structures, etc... The user will only download the output that is sent, not the entire contents of your include file. The user shouldn't notice any slowdown caused by your include. ----- Original Message ----- From: "Nikola Veber" <veber@ptt.yu> To: "Chris Lee" <lee@mediawaveonline.com>; "php forum" <php-general@lists.php.net> Sent: Monday, September 17, 2001 10:34 PM Subject: [PHP] Re: include question > I'm afraid you have not understood me completely: > My only concern on this topic is: Will the user be forced to wait for the whole included php file to load, or the server > will just take the desired function from that file? My goal here is to call different fragments of html code depending > on user selection by using functions that have the echo command. I am only afraid of all functions from included file > beeing loaded, and not only the called one. Is this the right way to approach this problem, or you would suggest smth > else? > > Thanks > Nikola > 9/18/01 6:25:49 PM, "Chris Lee" <lee@mediawaveonline.com> wrote: > > >include() has two different workings depnding on how it is called. > > > >include('include/test.php'); > >php will open the file and litterally take everything in that and paste into > >where the include() is, just like when you open the file in an editor, the > >file is un-parsed raw src. functions, comments, whitespaces, html, etc, etc, > >etc. > > > > >>include('http://www.e-tankless.com/products.php'); > >php will make a http request to that file, just like if you typed it into > >your browser, ie the remote server will parse the file and only send you the > >parsed data, not the source code, obviously though, how could you get > >someone elses code right? > > > > Chris Lee > > lee@mediawaveonline.com > > > > > > > > > > -- > 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 (#67736) next »