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" <[EMAIL PROTECTED]>
To: "Chris Lee" <[EMAIL PROTECTED]>; "php forum"
<[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]> 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
> >  [EMAIL PROTECTED]
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to